title: Disable turn off this device to save power for NIC
body: <pre><code>$NICs = Get-WmiObject Win32_NetworkAdapter -filter "AdapterTypeID = '0' AND PhysicalAdapter = 'true' AND NOT Description LIKE '%wireless%' AND NOT Description LIKE '%virtual%' AND NOT Description LIKE '%WiFi%' AND NOT Description LIKE '%Bluetooth%'"
  Foreach ($NIC in $NICs)
  {
      $powerMgmt = Get-WmiObject MSPower_DeviceEnable -Namespace root\wmi | where {$_.InstanceName -match [regex]::Escape($nic.PNPDeviceID)}
      If ($powerMgmt.Enable -eq $True)
      {
           $powerMgmt.Enable = $False
           $powerMgmt.psbase.Put()
      }
  }
  </code></pre>
  
  <p>I have this code, and i works, but PSAnalyzer says
  "For PowerShell 3.0 and above, use CIM cmdlet which perform the same tasks as the WMI cmdlets. The CIM cmdlets comply with WS-Management (WSMan) standards and with the Common Information Model (CIM) standard, which enables the cmdlets to use the same techniques to manage Windows computers and those running other operating systems."
  How to rewrite it using CIM cmdlet?</p>