Advertisement
Guest User

Untitled

a guest
Aug 7th, 2023
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 0.64 KB | Software | 0 0
  1. Detection:
  2. $PowerRegPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power'
  3. $PowerRegName = 'HiberbootEnabled'
  4.  
  5. # If registry key is not "0", remediate.
  6. if ( ((Get-ItemProperty -Path $PowerRegPath -Name $PowerRegName).$PowerRegName) -ne 0 ) {
  7.     # Registry key is not correct, trigger remediation script
  8.     exit 1
  9. } else {
  10.     # Registry key is correct, do not trigger remediation script
  11.     exit 0
  12. }
  13.  
  14. Remediation:
  15. $PowerRegPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power'
  16. $PowerRegName = 'HiberbootEnabled'
  17. Set-ItemProperty -Path $PowerRegPath -Name $PowerRegName -Value 0 -Force -Confirm:$false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement