0

I have a powershell script that is working at Night in office PC - (wiht out admin privileges)- the problem is at night time Updates are getting pushed and system is restarting and script wont start since I do not have batch execution or other similar right.

There is a way to 'end task' windows updates though powershell in task manager.

However, I wanted to know if it is safe - I will restart pc once I am back to office.

I cannot disable the update service - no rights are there. Mainly wanted to know the difference between update service and update task.

  1. Update service is responsible for update downloads? or task is responsible?
  2. Is update service is responsible for installing the updates or the task is responsible?
  3. What while happen (cons) if I keep running a script to end task the windows update task every minute.
  4. I tried the 'shutdown -a' every minute but came to know it wont effect the updates based shutdown.

No admin privileges - so bye bye to gpedit, regedits etc based solutions.

Once the update is done - there will be a screen asking for restart (5-15 mins) or manual restart after an hour etc - but since no one will be there it is auto restarting. Please advice. - It is really helpful to know more on it.

2 Answers 2

0

If you do not have administrative privileges you won't be able to stop/kill the windows update service or task. Even if you did have the appropriate permissions, interfering with windows update on a production server seems like a bad idea on a number of different levels.

Rather than fiddle with windows updates, I think that there is probably a better approach. It sounds like your script runs for a long time. Are updates being pushed at a known time? Include logic in your script to have it stop running right before the the updates will be installed. Output your script progress to a file. After the server reboots you can configure the same script to run again automatically upon startup/logon or as a scheduled task. The script can read in the script status from your output file and pick up where it left off before the reboot.

If you do not know the specific time when updates will be installed, you can include logic in your script to check periodically to see if the windows update client process is running (wuauclt). When the update process is detected, have your script stop running.

The obvious problem with this approach is that a startup script requires administrative privileges. Maybe the only thing you can do is configure the script as a logon script so that it will be run the following day automatically when you log in to the server.

8
  • Thank you, this is not a server etc.. this is just my office desktop - basic windows pc nothing more - nothing business critical here. I can kill the task but not the service - so I modified my script to kill the task when ever it is found - script runs for search and kill every 1 minute. I went to this method so that I need not have anything stopping the pc from running the script - script is basically for running some data from DB and send a mail - nothing more.
    – surpavan
    Sep 20, 2016 at 16:56
  • If you kill the windows update client process you run the risk of corrupting the windows update cache. This means that windows updates may not be able to install correctly when you actually want to install them. The windows update client log file can be found here: c:\windows\WindowsUpdate.log
    – wrieedx
    Sep 21, 2016 at 0:15
  • I record if I kill the process, I will check if there are logs once there are any update push -generally this happens on 2nd Tuesday only I think
    – surpavan
    Sep 21, 2016 at 6:26
  • I tried this and it could not detect the task - is the task name correct? Get-Process wuauserv; or should the task name be 'wuauclt'
    – surpavan
    Sep 25, 2016 at 4:27
  • 1
    In your environment, workstations are forcibly restarted when updates finish installing, right? I'm not sure if the wuauclt process actually initiates the reboot, but it does run when there are updates to install, and when the updates are actually being installed, all the way up until the reboot happens. If you interrupt wuauclt while updates are being installed the install process will be aborted and the workstation will not restart (however as I mentioned, you may experience difficulty installing updates later if you kill wuauclt).
    – wrieedx
    Sep 27, 2016 at 6:05
1

Please if possible contact your local IT dept and ask them to remove your device from the automatic reboot schedule.

Trying to circumvent automatic reboots may have other implications you're not aware of.

Within my company attempting to change a windows system application which is tied to compliance and security would be regarded as gross misconduct.

2
  • ok - but I am not disabling the feature - I am just restarting it later - so that is my I am genuinely asking what task/service would do. I have already spoken to them and they are not willing to do ANYTHING that will be BENEFICIAL to the COMPANY.
    – surpavan
    Sep 17, 2016 at 16:25
  • and what if the PC is shutdown at night - then the updates will run in the morning - so no issues there - I generally shutdown the PC always - except from last week - so Genuinely there is not breach of policy too.
    – surpavan
    Sep 18, 2016 at 6:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .