UnikajusingWMICmdlet

poziom ważności: ostrzeżenie

Description

Ta reguła wykrywa użycie cmdletów Windows Management Instrumentation (WMI). Od PowerShell 3.0 powinieneś używać cmdletów Common Information Model (CIM) zamiast cmdletów WMI. CMDLETS CIM są zgodne ze standardami WS-Management (WSMan) oraz standardem CIM, który umożliwia zarządzanie systemami operacyjnymi Windows i nie-Windows.

Nie używaj tych cmdletów WMI:

  • Get-WmiObject
  • Remove-WmiObject
  • Invoke-WmiMethod
  • Register-WmiEvent
  • Set-WmiInstance

Zamiast tego użyj tych cmdletów CIM:

  • Get-CimInstance
  • Remove-CimInstance
  • Invoke-CimMethod
  • Register-CimIndicationEvent
  • Set-CimInstance

Example

Niezgodne

Get-WmiObject -Query 'Select * from Win32_Process where name LIKE "myprocess%"' | Remove-WmiObject
Invoke-WmiMethod -Class Win32_Process -Name 'Create' -ArgumentList @{ CommandLine = 'notepad.exe' }

Zgodne

Get-CimInstance -Query 'Select * from Win32_Process where name LIKE "myprocess%"' | Remove-CimInstance
Invoke-CimMethod -ClassName Win32_Process -MethodName 'Create' -Arguments @{ CommandLine = 'notepad.exe' }