简体   繁体   中英

GPO/cmd to Powershell

I'm on the search to get a GPO command to a Powershell command

I cant find a way to phrase it to powershell

i got this gpo command

Powercfg -setDCValueIndex 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0

this works on the gpo but can i make this to work with a powershell script, i tried it with powercfg -change but i work wrong with it or it isnt possible this way

do i have to make a gpo object in powershell ? like this

New-GPO -Name "MyGPO" | New-GPLink -target "to change" -LinkEnabled Yes"

if yes this is the only thing i found so far in this case i try to change the usb selective suspend off for both instances the other code would only change DC to AC so well yeah

i know the GUID for the subgroup and the GUID for the setting but how to work with this in powershell script

Found a workaround

you can run

powercfg /SETACVALUEINDEX SCHEME_CURRENT 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0 

and

powercfg /SETDCVALUEINDEX SCHEME_CURRENT 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0

so you have disabled those options you can run this as batchfile as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM