Skip to content

Instantly share code, notes, and snippets.

@itpropro
Created March 4, 2016 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itpropro/803bdbd93711bcda44ee to your computer and use it in GitHub Desktop.
Save itpropro/803bdbd93711bcda44ee to your computer and use it in GitHub Desktop.
$nics = Get-CimInstance Win32_NetworkAdapter -Filter 'netenabled = true'
$powerenabled = Get-CimInstance -Namespace root\wmi -ClassName MSPower_DeviceWakeEnable
$nics|% {if ($powerenabled.InstanceName -match [regex]::Escape($_.PNPDeviceID)) {$powernics = $_.PNPDeviceID}}
$Items = $powerenabled|Where-Object {$_.InstanceName -like "$powernics*"}
$Items.Enable = $true
Set-CimInstance -InputObject $Items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment