Partager via


USBF_Filter (Industry 8.1)

7/8/2014

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

This class enables or disables USB Filter and resets the permissions list.

Syntax

class USBF_Filter {
    [Key, Read] string ID;
    [Read] boolean Enabled;

    UInt32 Enable();
    UInt32 Disable();
    UInt32 ResetPermissionList();
};

Members

The following tables list any methods and properties that belong to this class.

Methods

Methods

Description

USBF_Filter.Enable

Immediately enables USB Filter for the current session.

USBF_Filter.Disable

Immediately disables USB Filter for the current session.

USBF_Filter.ResetPermissionList

Deletes all existing USB Filter permission list entries.

Resetting the permission list while USB Filter is enabled prevents any USB device from connecting to the current session.

Properties

Property

Data type

Qualifiers

Description

ID

string

[key, read]

A unique ID that is required to obtain an instance of USBF_Filter.

This is always set to USBF_Filter.

Enabled

Boolean

[read]

Indicates if USB Filter is enabled for the current session.

Example

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

Get USB Filter state

This example Windows PowerShell script displays the state of USB Filter.

#Get and display USB Filter state
cls

$WmiNS = "root\standardcimv2\embedded"
$filter = Get-WmiObject -namespace $wmiNS -class USBF_Filter
echo "USB Filter State : "$filter | format-list Enabled

Enable USB Filter

This example Windows PowerShell script enables USB Filter and displays the state of USB Filter.

#Enable USB Filter
cls

#Get and display filter state
$WmiNS = "root\standardcimv2\embedded"
$filter = Get-WmiObject -namespace $wmiNS -class USBF_Filter
echo "USB Filter State : "$filter | format-list Enabled

#Enable Filter
echo "Enabling filter"
$filter.Enable();

#Get and display filter state
$filter = Get-WmiObject -namespace $wmiNS -class USBF_Filter
echo "USB Filter State : "$filter | format-list Enabled

Disable USB Filter

This example Windows PowerShell script disables USB Filter and displays the state of USB Filter.

#Disable USB Filter
cls

#Get and display USB Filter state
$WmiNS = "root\standardcimv2\embedded"
$filter = Get-WmiObject -namespace $wmiNS -class USBF_Filter
echo "USB Filter State : "$filter | format-list Enabled

#Disable USB Filter
echo "Disabling filter"
$filter.Disable();

#Get and display USB Filter state
$filter = Get-WmiObject -namespace $wmiNS -class USBF_Filter
echo "USB Filter State : "$filter | format-list Enabled

Reset permission list

This example Windows PowerShell script resets the permission entry list of USB Filter and then displays all permission entries.

#Reset permission list to empty list

$wmiNS = "root\standardcimv2\embedded"
$filter = Get-WmiObject -namespace $wmiNS -class USBF_Filter

#Reset Permission list
$filter.ResetPermissionList();

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

See Also

Reference

USB Filter WMI provider reference

Concepts

USB Filter