VMware Cloud Community
vin01
Expert
Expert

Local gp are not applying on windows machines

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:

pastedImage_1.png

pastedImage_3.png

Regards Vineeth.K
0 Kudos
4 Replies
LucD
Leadership
Leadership

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

0 Kudos
vin01
Expert
Expert

Is there any way to set those policies in gpo Using powershell?

Regards Vineeth.K
0 Kudos
LucD
Leadership
Leadership

There is a GroupPolicy module.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vin01
Expert
Expert

Thanks I’ll give a try.

Regards Vineeth.K
0 Kudos