45 lines
1.8 KiB
PowerShell
45 lines
1.8 KiB
PowerShell
|
# windows powershell bootstrap script
|
||
|
$host.ui.RawUI.WindowTitle = "Bootstrapping Windows"
|
||
|
|
||
|
|
||
|
New-Item -Path "c:\" -Name "logs" -ItemType "directory"
|
||
|
New-Item -Path "c:\" -Name "tools" -ItemType "directory"
|
||
|
|
||
|
# supress network location Prompt
|
||
|
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" -Force
|
||
|
|
||
|
# set network to private
|
||
|
|
||
|
# Make administrator user active for desktop OS
|
||
|
net user administrator /active:yes
|
||
|
|
||
|
# disable windows defender If you install your own AV later
|
||
|
#if ($KERNELVERSION -ge (new-object 'Version' 10,0)) {
|
||
|
# Set-MpPreference -DisableRealtimeMonitoring $true -DisableArchiveScanning $true -DisableIOAVProtection $true
|
||
|
#}
|
||
|
|
||
|
$netprofile = Get-NetConnectionProfile
|
||
|
Set-NetConnectionProfile -Name $netprofile.Name -NetworkCategory Private
|
||
|
|
||
|
# enable winrm on http
|
||
|
|
||
|
winrm quickconfig -quiet
|
||
|
# config winrm settings to work with packer
|
||
|
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
||
|
winrm set winrm/config/service/auth '@{Basic="true"}'
|
||
|
|
||
|
# configure powersaving and screen saver
|
||
|
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
|
||
|
powercfg -change -monitor-timeout-ac 0
|
||
|
powercfg -hibernate OFF
|
||
|
|
||
|
New-Itemproperty -Path "registry::HKCU\Control Panel\Desktop" -Name ScreenSaveActive -Value 0 -PropertyType "DWord" -Force
|
||
|
New-Itemproperty -Path "registry::HKCU\Control Panel\Desktop" -Name ScreenSaveTimeOut -Value 0 -PropertyType "DWord" -Force
|
||
|
New-Itemproperty -Path "registry::HKU\.DEFAULT\Control Panel\Desktop" -Name ScreenSaveActive -Value 0 -PropertyType "DWord" -Force
|
||
|
New-Itemproperty -Path "registry::HKU\.DEFAULT\Control Panel\Desktop" -Name ScreenSaveTimeOut -Value 0 -PropertyType "DWord" -Force
|
||
|
|
||
|
#Stop windows updtes from starting immediatly
|
||
|
$WUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
|
||
|
$WUSettings.NotificationLevel=1
|
||
|
$WUSettings.save()
|