none
0X1 Error RRS feed

  • Question

  • hi

    I work for an educational institution Windows update causes a couple of restart and showing "configuring windows update ...Please do not restart or unplug your computer ..." during system reboot and in the middle of exam an session

    I have a Local WSUS

    I did some digging and found regular windows update might not be suitable for me so I have decided to go with PowerShell Script for deploying windows update the reason for it some times computers not be used for a while and then when a student will try to turn it on it will take more that a hour to initialize previously installed updates "the screen shows Please wait stage some number of number ... " especially when a computer did install update and shutdown ..the next boot will take forever would like to mitigate this issue and do the following:

    1-Restart all computers at 10:30 PM every day

    2-start checking for update then install whatever is available on WSUS then restart at 11:00 PM every day

    3-preform the last restart "incase of any restart is pending "

    4-Shutdown on 02:00 AM

    Using group policy I have deployed Task.PS1 as startup script that contain the following codes :

    # Triggers
    $FirstRestart = New-JobTrigger -Daily -At "10:30 PM"
    $Wu = New-JobTrigger -Daily -At "11:00 PM"
    $SecondRestart =New-JobTrigger -Daily -at "01:30 AM"
    $Shutdwon= New-JobTrigger -Daily -At "02:00 AM"
    # Options
    $Options = New-ScheduledJobOption -ContinueIfGoingOnBattery -RequireNetwork -StartIfOnBattery -RunElevated
    # ScriptS
    $scriptRestart = '\\172.30.0.12\pss\Restart.ps1'
    $scriptWu = '\\172.30.0.12\pss\Wu.ps1'
    $scriptSHutdown = '\\172.30.0.12\pss\Shutdown.ps1'
    # Tasks
    Register-ScheduledJob -Name Restarts -FilePath $scriptRestart -Trigger  $FirstRestart,$SecondRestart -ScheduledJobOption $Options
    Register-ScheduledJob -Name WIndowsUpdate -FilePath $scriptWu -Trigger  $Wu -ScheduledJobOption $Options
    Register-ScheduledJob -Name ShutDown -FilePath $scriptSHutdown -Trigger  $Shutdwon -ScheduledJobOption $Options
    


    I have shared a folder on one of my domain controllers that contain the three scripts  as well as the modules that require by my script :

    restart.ps1 contain:

    Restart-Computer -Force


    shutdown.ps1contain:

    Stop-Computer -Force


    WU.ps1 contain :

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted
    Import-Module -Name \\172.30.0.12\pss\WUpdate\PSWindowsUpdate.psm1
    Get-WUInstall -Acceptall -Autoreboot -Verbose


    first issue
    the task can not be deployed to the clients
    second Issue
    when I run the task1.ps1 manually on a test client it will work properly all the tasks that have been specified within the script will be created !
    but when I click on them to run they show 1X0 Error
    any idea or help ?

    best

    shad


    • Edited by Tahseen Taha Tuesday, November 17, 2015 12:21 PM
    Tuesday, November 17, 2015 8:00 AM

Answers

  • thanks for you replay jrv,

    I totally agree with your recommendations but here is the consequences :

    I have configured updates to be installed on Every Thursday @10:00 PM

    this method is working perfectly it will install all updates as I planned for on desired date and time every Thursday then shuts down the client lets call this "Point A"

    when someone "student" try to turn on the machine after "Point A" windows will show "Configuring Windows update ... Please wait.. " screen sometimes will last for 10 minutes and more !

    in my environment this kind of situations is bad !

    that's why I'm looking for some alternatives especially a script to do the job instead of GP

    I will take your advice and will give a shoot to deploy scripts using scheduled tasks in Group policy preferences.

    Please forgive me for my English I'm not an Native English speaker :) 

    That is because you are not configuring the system correctly and you are turning the machines off when there are updates pending.  If you allow the machines to sleep and apply updates in the middle of the night then you will not have theses issues.


    \_(ツ)_/

    • Marked as answer by Tahseen Taha Sunday, November 22, 2015 7:53 PM
    Tuesday, November 17, 2015 3:15 PM

All replies

  • You need to configure Windows Update to install only outside of class hours.  TO learn how to correctly configure and manage WU post you issues in the Windows platform forum.

    In any case the script yu posted is unreadable and unusable.


    \_(ツ)_/

    Tuesday, November 17, 2015 11:18 AM
  • Hi

    I would like to install windows updates Via PowerShell scrip Rather than windows update Via GPO

    thanks for letting me know my test is not usable

    I will modify it right away

    Best

    shad


    • Edited by Tahseen Taha Tuesday, November 17, 2015 11:38 AM typo
    Tuesday, November 17, 2015 11:35 AM
  • Then you need to start by posting a readable script. What you have posted is not readable.  You cannot post formatted and colorized text.  It looks like hell in many browsers.  All lines are broken multiple times in most browsers.

    \_(ツ)_/

    Tuesday, November 17, 2015 11:47 AM
  • To follow up on jrv's post, there's an option to 'insert code block' which will turn

    Register-ScheduledJob

    -NameRestarts-FilePath$scriptRestart-Trigger  $FirstRestart,$SecondRestart-ScheduledJobOption$Options


    into:

    Register-ScheduledJob -Name Restarts -FilePath $scriptRestart -Trigger $FirstRestart,$SecondRestart -ScheduledJobOption $Options
    which will work much better. It's the second icon from the right at the top of the reply box.


    Tuesday, November 17, 2015 12:09 PM
  • you were right the code I have posted was mess !

    so sorry for that

    shad

    Tuesday, November 17, 2015 12:14 PM
  • Many thanks that was useful :) 
    Tuesday, November 17, 2015 12:21 PM
  • Much better.  Thank you.

    You are deploying this as a startup script.  Why?  It should be deployed as a scheduled task set to run when you want it to run.

    If you are having issues wit GP working as you expect you will need to post issue in GP forum.

    I still highly recommend that you just use GP to define the run times for update. The settings will allow you to specify the time and to disable reboots if a user is currently logged in. I have used this method for years and have never had an issue.  All updates are automatically applied out of normal hours.

    On Vista and later systems the systems do not reboot until they are idle for a long time.  They will then op up a notice which allows the user to delay the restart.


    \_(ツ)_/

    Tuesday, November 17, 2015 12:33 PM
  • thanks for you replay jrv,

    I totally agree with your recommendations but here is the consequences :

    I have configured updates to be installed on Every Thursday @10:00 PM

    this method is working perfectly it will install all updates as I planned for on desired date and time every Thursday then shuts down the client lets call this "Point A"

    when someone "student" try to turn on the machine after "Point A" windows will show "Configuring Windows update ... Please wait.. " screen sometimes will last for 10 minutes and more !

    in my environment this kind of situations is bad !

    that's why I'm looking for some alternatives especially a script to do the job instead of GP

    I will take your advice and will give a shoot to deploy scripts using scheduled tasks in Group policy preferences.

    Please forgive me for my English I'm not an Native English speaker :) 

    Tuesday, November 17, 2015 3:07 PM
  • thanks for you replay jrv,

    I totally agree with your recommendations but here is the consequences :

    I have configured updates to be installed on Every Thursday @10:00 PM

    this method is working perfectly it will install all updates as I planned for on desired date and time every Thursday then shuts down the client lets call this "Point A"

    when someone "student" try to turn on the machine after "Point A" windows will show "Configuring Windows update ... Please wait.. " screen sometimes will last for 10 minutes and more !

    in my environment this kind of situations is bad !

    that's why I'm looking for some alternatives especially a script to do the job instead of GP

    I will take your advice and will give a shoot to deploy scripts using scheduled tasks in Group policy preferences.

    Please forgive me for my English I'm not an Native English speaker :) 

    That is because you are not configuring the system correctly and you are turning the machines off when there are updates pending.  If you allow the machines to sleep and apply updates in the middle of the night then you will not have theses issues.


    \_(ツ)_/

    • Marked as answer by Tahseen Taha Sunday, November 22, 2015 7:53 PM
    Tuesday, November 17, 2015 3:15 PM
  • I took closer look into GPO's that we have

    you are right there is no window to install updates

    I will spend so much time to rectify this issue

    Many thanks again

    shad

    Sunday, November 22, 2015 7:53 PM