Skip to content

Commit 6f2a57b

Browse files
committed
Update AvoidUsingWMICmdlet.md
1 parent 72858d2 commit 6f2a57b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

RuleDocumentation/AvoidUsingWMICmdlet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ Use corresponding CIM cmdlets such as Get-CIMInstance, Remove-CIMInstance, Invok
1414

1515
##Example
1616

17+
Wrong:
18+
Get-WmiObject -Query 'Select * from Win32_Process where name LIKE "myprocess%"' | Remove-WmiObject
19+
Invoke-WmiMethod –Class Win32_Process –Name "Create" –ArgumentList @{ CommandLine = "notepad.exe" }
20+
21+
Correct:
1722
Get-CimInstance -Query 'Select * from Win32_Process where name LIKE "myprocess%"' | Remove-CIMInstance
1823
Invoke-CimMethod –ClassName Win32_Process –MethodName "Create" –Arguments @{ CommandLine = "notepad.exe" }

0 commit comments

Comments
 (0)