< Back

New-GPOWmiFilter

Fri Jan 10, 2020 7:08 pm

NAME New-GPOWmiFilter



SYNOPSIS

Creates a new WMI filter.





SYNTAX

New-GPOWmiFilter [-Name] <String> [-Expression] <String[]> [[-Description] <String>] [[-Domain] <String>]

[[-Author] <String>] [-WithReplace] [-Credential <PSCredential>] [-PassThru] [-CimSession <CimSession>]

[<CommonParameters>]



New-GPOWmiFilter [-WithReplace] [-InputObject] <Object> [-Credential <PSCredential>] [-PassThru] [-CimSession

<CimSession>] [<CommonParameters>]





DESCRIPTION

The cmdlet takes in the WMI filter properties and produces a usable WMI filter.





PARAMETERS

-Name <String>

The WMI filter name.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Expression <String[]>

The expressions to evaluate in the filter, can be multiple WMI queries for a single filter.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Description <String>

The WMI filter description. This defaults to the WMI Filter Name.



Required? false

Position? 4

Default value [System.String]::Empty

Accept pipeline input? false

Accept wildcard characters? false



-Domain <String>

The domain the WMI filter is being created in, defaults to the domain of the logged on user.



Required? false

Position? 5

Default value [System.String]::Empty

Accept pipeline input? false

Accept wildcard characters? false



-Author <String>

The author creating the WMI filter, defaults to the current user.



Required? false

Position? 6

Default value [System.String]::Empty

Accept pipeline input? false

Accept wildcard characters? false



-WithReplace [<SwitchParameter>]

If a WMI filter exists with the same name, the WMI query expression is updated.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-InputObject <Object>



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Credential <PSCredential>

Specifies a user account that has permission to perform this action. The default is the current user.



Type a user name, such as "User01" or "Domain01\\User01", or enter a PSCredential object, such as one generated

by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.



Required? false

Position? named

Default value [System.Management.Automation.PSCredential]::Empty

Accept pipeline input? false

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

Determines whether to return the new WMI filter object.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-CimSession <CimSession>

Specifies the CIM session to use for this cmdlet. Enter a variable that contains the CIM session or a command

that creates or gets the CIM session, such as the New-CimSession or Get-CimSession cmdlets. For more

information, see about_CimSessions.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Object





OUTPUTS

Microsoft.ActiveDirectory.Management.ADObject





NOTES





AUTHOR: Michael Haken

LAST UPDATE: 1/7/2017



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>New-GPOWmiFilter -Name "Windows Server 2012 R2" -Expression @("Select * From Win32_OperatingSystem Where

Version like '6.3%' and ProductType != 1")



Creates a WMI filter to target Windows Server 2012 R2.











RELATED LINKS