I'm struggling with this for the past few weeks and I hope someone has THE answer that works.
At my work we use VMWare and I've build a automated deployment of Windows server 2012R2 with Powershell, which is working great.
Most of my scripts are being executed on the VM itself and one of the functions is configuring Windows updates. I've found registry-keys for setting up Updates and Powershell is adding them into the register. The main problem is, is that those settings are not applied by the server. One of the settings is TIME and DAY.
After a couple of days fully researching, I've found out that there is an schedule task called Maintenance Configurator. I've found a way to disable that but that doesn't help (with psexec). My updates are still getting executed every day at 2AM.
Than I saw a schedule tasks with that setting. I changed that time to my desired time-windows and it executed at that time, but then it changed back to 2AM. I saw in the Action Center that the setting was still on 2AM, eventhough I've changed the schedule task manualy
How can I change this all by Powershell? I don't like the fact that the updates are being installed at 2AM, and I also don't like it that I cannot change it anywhere.
Hope someone knows how to fix
Best regards, Dave
I took a different approach, but i think I solved the same problem you are having. I used a management server (but could be your workstation) and created a csv with all my servers and the time they should update. You can then run a scheduled task on your management server to call invoke-wuinstall from this windows update module for each server in your csv.
I had to modify invoke-wuinstall to accept alternative credentials for each server, but hopefully you wont need to do that.
I realize you are trying to do this at setup, but the approach i suggest makes it easier to adjust times in the future. If configuration at setup is a requirement you could modify the approach to copy the windows update module to each machine then setup a scheduled task on that machine to call the script.