diff options
author | heqnx <root@heqnx.com> | 2025-07-11 21:50:55 +0300 |
---|---|---|
committer | heqnx <root@heqnx.com> | 2025-07-11 21:50:55 +0300 |
commit | 8cf16b5c899a60ea5982c5d8dc042153daf6ac5b (patch) | |
tree | d64092854fe32f4630f514b93b244b0b5eddc5d1 /packer/files/scripts/windows/init.ps1 | |
parent | 54ecdd04947e70026c96365ea29463f8b435c1aa (diff) | |
download | ansible-active-directory-range-8cf16b5c899a60ea5982c5d8dc042153daf6ac5b.tar.gz ansible-active-directory-range-8cf16b5c899a60ea5982c5d8dc042153daf6ac5b.zip |
added packer templates
Diffstat (limited to 'packer/files/scripts/windows/init.ps1')
-rw-r--r-- | packer/files/scripts/windows/init.ps1 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packer/files/scripts/windows/init.ps1 b/packer/files/scripts/windows/init.ps1 new file mode 100644 index 0000000..3eea7b4 --- /dev/null +++ b/packer/files/scripts/windows/init.ps1 @@ -0,0 +1,25 @@ +Get-WmiObject Win32_UserAccount -Filter "Name='packer'" | % { $_.PasswordExpires = $false; $_.Put() } | Out-Null + +if ((Get-WmiObject -Class Win32_OperatingSystem).ProductType -ne 1) { + Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "DisableCAD" -Value 1 -Force + + secedit /export /cfg C:\secpol.cfg + (Get-Content C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:\secpol.cfg + (Get-Content C:\secpol.cfg).replace("MinimumPasswordLength = 7", "MinimumPasswordLength = 0") | Out-File C:\secpol.cfg + secedit /configure /db C:\Windows\security\local.sdb /cfg C:\secpol.cfg /areas SECURITYPOLICY + Remove-Item -Force C:\secpol.cfg -Confirm:$false +} + +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Power", "HiberFileSizePercent", 0) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Power", "HibernateEnabled", 0) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Reliability", "ShutdownReasonOn", 1) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Reliability", "ShutdownReasonUI", 2) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge", "HideFirstRunExperience", 1) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoRebootWithLoggedOnUsers", 1) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU", "IncludeRecommendedUpdates", 0) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", 2) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge", "HideFirstRunExperience", 1) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoRebootWithLoggedOnUsers", 1) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU", "IncludeRecommendedUpdates", 0) +[Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", 2) + |