This is a windows based question sorry to post here. Can someone help me to fix this if possible as i am trying to apply on multiple machines using invoke-vmscript
I can able to set wusserver configuration in registry using set-itemproperty cmdlet but this is not reflecting in group policies even after reboot.
$wsusclientserver='LIBPRO27.LIBPOC.COM'
$defaultwindowssettings= @'
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUServer" -Value "https://$($wsusclientserver):80"
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUStatusServer" -Value "https://$($wsusclientserver):80"
Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Value "0"
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Value "3"
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "ScheduledInstallDay" -Value "0"
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "ScheduledInstallTime" -Value "3"
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "UseWUServer" -Value "1"
'@
$defaultwindowssettingssub = $ExecutionContext.InvokeCommand.ExpandString($defaultwindowssettings)
Invoke-VMScript -VM vm01 -GuestUser administrator -GuestPassword password -ScriptType Powershell -ScriptText $defaultwindowssettingssub
Output after execution:
Why are you changing this in the registry keys that are set by the Group Policies?
You're not supposed to change these settings directly, only through a GPO and with something like gpedit.
When the GPO is re-applied, these settings will be overwritten with the GPO settings.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Is there any way to set those policies in gpo Using powershell?
There is a GroupPolicy module.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks I’ll give a try.