-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisablePNP-Powersaving.ps1
38 lines (36 loc) · 1.01 KB
/
DisablePNP-Powersaving.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$hubs = Get-WmiObject Win32_USBController
$powerMgmt = Get-WmiObject MSPower_DeviceEnable -Namespace root\wmi
foreach ($p in $powerMgmt) {
$IN = $p.InstanceName.ToUpper()
foreach ($h in $hubs){
$PNPDI = $h.PNPDeviceID
if ($IN -like "*$PNPDI*"){
$p.enable = $False
$p.psbase.put()
}
}
}
$hubs = Get-WmiObject Win32_USBControllerDevice
$powerMgmt = Get-WmiObject MSPower_DeviceEnable -Namespace root\wmi
foreach ($p in $powerMgmt) {
$IN = $p.InstanceName.ToUpper()
foreach ($h in $hubs){
$PNPDI = $h.PNPDeviceID
if ($IN -like "*$PNPDI*"){
$p.enable = $False
$p.psbase.put()
}
}
}
$hubs = Get-WmiObject Win32_USBHub
$powerMgmt = Get-WmiObject MSPower_DeviceEnable -Namespace root\wmi
foreach ($p in $powerMgmt) {
$IN = $p.InstanceName.ToUpper()
foreach ($h in $hubs){
$PNPDI = $h.PNPDeviceID
if ($IN -like "*$PNPDI*"){
$p.enable = $False
$p.psbase.put()
}
}
}