mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
add playbooks and power shell scripts
add playbooks and power shell scripts
This commit is contained in:
1 parent
377688e218
commit
4d5c390d46
9 files changed
+324
No files matched your search
@@ -0,0 +1,10 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
foreach ($setting in @('standby-timeout-ac', 'standby-timeout-dc')) {
|
||||
& powercfg.exe /change $setting 0
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Failed to set power setting '$setting'."
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output 'Automatic sleep is disabled for the current power plan on AC and battery.'
|
||||
@@ -0,0 +1,21 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$explorerPolicyKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
|
||||
New-Item -Path $explorerPolicyKey -Force | Out-Null
|
||||
New-ItemProperty -Path $explorerPolicyKey -Name 'NoClose' -PropertyType DWord -Value 1 -Force | Out-Null
|
||||
|
||||
$powerSettings = @(
|
||||
'standby-timeout-ac',
|
||||
'standby-timeout-dc',
|
||||
'hibernate-timeout-ac',
|
||||
'hibernate-timeout-dc'
|
||||
)
|
||||
|
||||
foreach ($setting in $powerSettings) {
|
||||
& powercfg.exe /change $setting 0
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Failed to set power setting '$($setting[0])'."
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output 'Shutdown-related Start menu commands are hidden, and automatic sleep/hibernate timeouts are disabled for the current power plan.'
|
||||
@@ -0,0 +1,28 @@
|
||||
# Unblock-Computer-Shutdown.ps1
|
||||
# Re-enables normal shutdown behavior on Windows 11
|
||||
# Run as Administrator, then reboot
|
||||
|
||||
# Remove/Reset all policy keys set by BlockShutdown.ps1
|
||||
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' `
|
||||
-Name 'ShutdownWithoutLogon' -Value 1 -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' `
|
||||
-Name 'DisableShutdownOption' -ErrorAction SilentlyContinue
|
||||
|
||||
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' `
|
||||
-Name 'NoShutdown' -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' `
|
||||
-Name 'CloseSystemNoShutdown' -ErrorAction SilentlyContinue
|
||||
|
||||
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' `
|
||||
-Name 'DisableCACheck' -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' `
|
||||
-Name 'DisableTaskMgr' -ErrorAction SilentlyContinue
|
||||
|
||||
# Re-enable sleep and hibernate
|
||||
powercfg /change standby-timeout-ac 120 | Out-Null
|
||||
powercfg /change standby-timeout-dc 120 | Out-Null
|
||||
powercfg /change hibernate-timeout-ac 180 | Out-Null
|
||||
powercfg /change hibernate-timeout-dc 30 | Out-Null
|
||||
powercfg /h on
|
||||
|
||||
Write-Host "All shutdown restrictions removed. Reboot for changes to take full effect." -ForegroundColor Green
|
||||
@@ -0,0 +1,11 @@
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
Update-MpSignature
|
||||
|
||||
Set-MpPreference -DisableRealtimeMonitoring $false
|
||||
Set-MpPreference -DisableBehaviorMonitoring $false
|
||||
Set-MpPreference -PUAProtection Enabled
|
||||
Set-MpPreference -EnableControlledFolderAccess Enabled
|
||||
Set-MpPreference -EnableNetworkProtection Enabled
|
||||
Reference in new issue
Block a user