Поделиться через


USBF_PermissionEntry (Industry 8.1)

7/8/2014

Review the syntax, members. and examples of the USBF_PermissionEntry WMI provider class for Windows Embedded 8.1 Industry (Industry 8.1).

This class contains current information about the USB Filter permission entry list on a device.

Syntax

class USBF_PermissionEntry {
    [Key, Read] UInt32 PermissionLevel;
    [Key, Read] string PortLocationPath;
    [Key, Read] UInt32 DeviceClassID;
    [Key, Read] UInt32 DeviceVendorID;
    [Key, Read] UInt32 DeviceProductID;
};

Members

The following table lists the properties that belong to this class.

Properties

Property

Data type

Qualifiers

Description

PermissionLevel

UInt32

[key, read]

Indicates the port permission level.

ValueDescription
0Port is enabled for all USB devices.
1Port is enabled only for USB devices where their device class ID equals DeviceClassID.
2Port is enabled only for USB devices where their device class ID equals DeviceClassID, device vendor ID equals DeviceVendorID, and device product ID equals DeviceProductID.

PortLocationPath

string

[key, read]

Specifies the path of the USB port to be enabled.

This property is required.

DeviceClassID

UInt32

[key, read]

Specifies the device class ID to be enabled.

DeviceVendorID

UInt32

[key, read]

Specifies the device vendor ID to be enabled.

PortLocationPath, DeviceClassID, and DeviceProductID are required if this property is set.

DeviceProductID

UInt32

[key, read]

Specify the device product ID to be enabled.

PortLocationPath, DeviceClassID, and DeviceVendorID are required if this property is set.

Remarks

You must create USBF_PermissionEntry entries before any USB device can connect while USB Filter is enabled.

Example

The following examples demonstrate how to use the USBF_PermissionEntry class in a Windows PowerShell script.

Get permission list

This example Windows PowerShell script displays all existing permission entries for USB Filter.

#Get permission list
cls

$WmiNS = "root\standardcimv2\embedded"
$permissions = Get-WmiObject -namespace $wmiNS -class USBF_PermissionEntry
Echo "Total " $permissions.Count "USB Permission Entries"

#Display all permission entries
$permissions | format-table Port*, Device*, Permission*

Add a permission entry

This example Windows PowerShell script adds a permission entry for USB Filter for a specific USB device on a specific port. The USB device must have a class ID of 3, a vendor ID of 123, and a product ID of 12345 in order to connect by using this permission entry.

#Add a class-level permission entry
cls
$wmiNS = "root\standardcimv2\embedded"

#Get and display permission list
$permissions = Get-WmiObject -namespace $wmiNS -class USBF_PermissionEntry
Echo "Total " $permissions.Count "USB Permission Entries"
$permissions | format-table Port*, Device*, Permission*

#Add new permission
$PermissionEntryClass = [WMIClass] "root\standardcimv2\embedded:USBF_PermissionEntry"
$PermissionEntry = $PermissionEntryClass.CreateInstance();
$PermissionEntry.PortLocationPath = "PCIROOT(0)#PCI(1D07)#USB(2)"
$PermissionEntry.PermissionLevel  = 2       # Device Level
$PermissionEntry.DeviceClassID    = 3       # Class ID = 3
$PermissionEntry.DeviceProductID  = 12345
$PermissionEntry.DeviceVendorID   = 123
$PermissionEntry.Put()

#Get and display permission list
$permissions = Get-WmiObject -namespace $wmiNS -class USBF_PermissionEntry
Echo "Total " $permissions.Count "USB Permission Entries"
$permissions | format-table Port*, Device*, Permission*

Remove permission entry

This example Windows PowerShell script displays all permission entries for USB Filter, removes the first permission entry in the list, and then displays the list of all permission entries again to verify that the entry was removed.

#Remove first permission entry
cls

$WmiNS = "root\standardcimv2\embedded"
$permissions = Get-WmiObject -namespace $wmiNS -class USBF_PermissionEntry
Echo "Total " $permissions.Count "USB PermissionEntries"

#Display all permission entries
$permissions | format-table Port*, Device*, Permission*

#Remove first permission entry
$permissions[0].Delete();

$permissions = Get-WmiObject -namespace $wmiNS -class USBF_PermissionEntry
Echo "Total " $permissions.Count "USB Permission Entries"

#Display all permission entries
$permissions | format-table Port*, Device*, Permission*

See Also

Reference

USB Filter WMI provider reference
USBF_Filter