🕫 NEW 🕫- Kaseya Certified Expert Training Camp launches on 8/23. Class size is limited. Learn more > https://www.community.connectit.com/events/28-kaseya-certified-expert-traincamp-august-23rd-september-2nd

Windows 10 update to latest version

Reza Gholami
Reza Gholami Member
edited January 24 in Solutions

Product Name: Windows 10 update to latest version

Version: 1.2

Description : This will perform an entire Operating System upgrade, it is recommended to perform a backup and/or system restore point before proceeding with the OS upgrade.
The workstation will be restarted as part of the procedure.
The whole process takes between 45 minutes and 2 hours until the workstation can be used again.
It is recommended to update Rapid Technology driver before you run this script.
It is also recommended to have at least 20 GB free on the endpoint before running the procedure, otherwise the procedure could fail without giving any error message.
This listing does not require to upload any files. It will download a file directly form Microsoft to perform the upgrade.
It will give them 30 minutes before restarting automatically, if it doesn't get any respond it will reboot it after 30 minutes automatically. It will also delete the tool after 3 hours.

Reza Gholami
[email protected]
8/20/2019

Instructions :

1- Make sure you have at least 20 GB free on endpoint.

2- Update "Rapid Technology" driver on endpoint.

3- Make sure there is no restart pending on endpoint.

4- Run this script.

«134

Comments

  • Oscar Hernandez
    Oscar Hernandez Member CHOCOLATE MILK
    edited August 2019

    I've ran this procedure on two separate servers and the procedure remains pending. Has this worked for anyone else? 

  • Reza Gholami
    Reza Gholami Member
    edited August 2019

    Oscar,

    1903 is just for Windows 10.

    I tested it on more than 30 machines with different versions from 1511 to 1809 before I publish it and all worked fine.

  • Oscar Hernandez
    Oscar Hernandez Member CHOCOLATE MILK
    edited August 2019

    Sorry Reza, when I meant two different servers, I meant from two differnet VSA servers on separate windows 10 endpoints. It fails on the command line Step 4. I apologize for confusion. 

  • Oscar Hernandez
    Oscar Hernandez Member CHOCOLATE MILK
    edited August 2019

    It seems to have worked on one of my Window's 10 machines. I am troubleshooting the other one it failed on, timed out command line. 


  • Reza Gholami
    Reza Gholami Member
    edited August 2019

    No problem at all Oscar,

    I'm glad you've tried it. It should work based on my test on different machines with different user permissions.

    Please let us know how it goes on the other one. Reboot it and then try it again. LOL

    Thank you

  • Reza Gholami
    Reza Gholami Member
    edited August 2019

    Oscar,

    Please update Rapid technology driver/software on those computers and then try to run the script to see how it goes.

    Thanks

  • Datalyst
    Datalyst Member CHOCOLATE MILK
    edited September 2019

    Please add a systems restore point into the script

    ExecuteShellCommand, as system in 64 bit

    wmic /namespace:\\root\default path SystemRestore call CreateRestorePoint "Pre-Win 10 1903 Upgrade", 100, 0

  • Edna Rainey
    Edna Rainey MarylandMember CHOCOLATE MILK
    edited September 2019

    System Restore, yes! I tried this on a machine running 1803 and one running 1809. It upgraded both without issue.

  • Datalyst
    Datalyst Member CHOCOLATE MILK
    edited September 2019

    Can we also add a self checking disk space limitation PS command?  If there is disk space, great continue on, if not abort the script

     Get-WmiObject win32_logicaldisk -Filter "Drivetype=3" | %{

        if ($_.FreeSpace/1GB -lt 20){

     write-host "Low disk space, aborting windows 10 1903 upgrade"

            }

           else

    {

     write-host "Enough disk space, continuing with Windows 10 1903 upgrade "

     }

     }


  • Datalyst
    Datalyst Member CHOCOLATE MILK
    edited September 2019

    Trying to replace "Drivetype=3 with "deviceid='$($os.systemdrive)'" as some machines may have more than one local drive and the OS drive may NOT be the "C" drive but cannot get that to work correctly yet.

    Also, Should we also have as step 1 in the script a validation check that the OS is indeed Windows 10 we are upgrading?

  • Datalyst
    Datalyst Member CHOCOLATE MILK
    edited September 2019

    Resolved both issues.

    1. Run on windows 10 only.  Set each script line to only run on Windows 10

    2. Disk space.  Added a get variable for "root\cimv2:Win32_LogicalDisk.FreeSpace"

    3. used IF EVAL to calculate free disk space ((#FreeSpace#/1024)/1024)/1024 is greater than or equal to 40  (double what MS states)

    4. If there is space, perform the update

    5. No space, abort

    "); vertical-align: bottom; height: 10px;"><Procedure name="Windows 10 update to 1903" treePres="3" id="1716255236" folderId="980695641311208" treeFullPath="DTL Testing">
    "); vertical-align: bottom; height: 10px;"><Body description="It will download Windows 10 update 1903 tool and updates the Windows and at the end notify user to reboot the computer and give them 30 minutes, if it doesn't get any respond it will reboot it after 30 minutes automatically . ">
    "); vertical-align: bottom; height: 10px;"><Statement name="GetVariable" continueOnFail="false" osType="10">
    <Parameter xsi:type="EnumParameter" name="VariableType" value="WMIProperty"/>
    <Parameter xsi:type="StringParameter" name="SourceContent" value="root\cimv2:Win32_LogicalDisk.FreeSpace"/>
    <Parameter xsi:type="StringParameter" name="VariableName" value="FreeSpace"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><Statement name="GetVariable" continueOnFail="false" osType="10">
    <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue"/>
    <Parameter xsi:type="StringParameter" name="SourceContent" value="#vAgentconfiguration.AgentTempDir#\Windows10-1903"/>
    <Parameter xsi:type="StringParameter" name="VariableName" value="win"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><If description="">
    "); vertical-align: bottom; height: 10px;"><Condition name="EvaluateExpression">
    <Parameter xsi:type="StringParameter" name="ExpressionText" value="((#FreeSpace#/1024)/1024)/1024"/>
    <Parameter xsi:type="EnumParameter" name="Condition" value="GreaterThanOrEquals"/>
    <Parameter xsi:type="StringParameter" name="Value" value="40"/>
    </Condition>
    "); vertical-align: bottom; height: 10px;"><Then>
    "); vertical-align: bottom; height: 10px;"><Statement name="WriteScriptLogEntry" continueOnFail="false" osType="10">
    <Parameter xsi:type="StringParameter" name="Comment" value="Enough disk space to Upgrade Windows 10 1903"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><Statement name="ExecuteShellCommand" continueOnFail="false" osType="10">
    <Parameter xsi:type="StringParameter" name="Command" value="wmic /namespace:\\root\default path SystemRestore call CreateRestorePoint "Pre-Win 10 1903 Upgrade", 100, 0"/>
    <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System"/>
    <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="True"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><Statement name="ExecuteShellCommand" continueOnFail="false" osType="10">
    <Parameter xsi:type="StringParameter" name="Command" value="mkdir #win#"/>
    <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System"/>
    <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><Statement name="GetURL" continueOnFail="false" osType="10">
    <Parameter xsi:type="StringParameter" name="URL" value="https://go.microsoft.com/fwlink/?LinkID=799445"/>
    <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#win#\Windows10Upgrade9252.exe"/>
    <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="True"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><Statement name="ExecuteShellCommand" continueOnFail="false" osType="10">
    <Parameter xsi:type="StringParameter" name="Command" value="#win#\Windows10Upgrade9252.exe /quietinstall /skipeula /auto upgrade /copylogs #win\logs"/>
    <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System"/>
    <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><Statement name="PauseScript" continueOnFail="false" osType="10">
    <Parameter xsi:type="IntegerParameter" name="Seconds" value="10800"/>
    </Statement>
    "); vertical-align: bottom; height: 10px;"><Statement name="Delete Directory" continueOnFail="false" osType="10">
    <Parameter xsi:type="StringParameter" name="Parameter1" value="#win#"/>
    <Parameter xsi:type="StringParameter" name="Parameter2" value="true"/>
    </Statement>
    </Then>
    "); vertical-align: bottom; height: 10px;"><Else>
    "); vertical-align: bottom; height: 10px;"><Statement name="WriteScriptLogEntry" continueOnFail="false" osType="10">
    <Parameter xsi:type="StringParameter" name="Comment" value="Not enough disk space to upgrade to Windows 10"/>
    </Statement>
    </Else>
    </If>
    </Body>
    </Procedure>
    </ScriptExport>


  • Edna Rainey
    Edna Rainey MarylandMember CHOCOLATE MILK
    edited September 2019

    I tried this on another Win 10 machine and it did not execute. Could this be because it was set at "Semi-Annual Channel (Targeted)? 

  • Edna Rainey
    Edna Rainey MarylandMember CHOCOLATE MILK
    edited September 2019

    I tried this on another Win 10 machine and it did not execute. Could this be because it was set at "Semi-Annual Channel (Targeted)? 

  • Bud Manz
    Bud Manz Member
    edited September 2019

    Hi Edna,

    Did you, by chance, check to make sure there was no restart pending (like for other updates)?

    HTH,
    Bud Manz

  • michael hardee
    edited September 2019

    Am I crazy or is this missing the "give the user 30 minutes to reboot" feature it talks about in the description?  I see it pauses for 3 hours before cleaning up after itself, but the reboot portion doesn't seem to actually be happening

  • Jonathon Nash
    Jonathon Nash Member
    edited September 2019

    Nope, it definitely just instant restarts the computer without notice. The 30 minutes is built into the Windows Feature updater IF it's not set to install quietly. I personally don't care, I run the procedure at night.

  • Marc Punte
    Marc Punte NetherlandsMember
    edited September 2019

    I've tried the procedure with, and without the quiet parameter, but it always reboots the machine without asking the user if it's ok...

    any ideas how to fix this.?

  • Reza Gholami
    Reza Gholami Member
    edited September 2019

    It will notify user with and without quiet parameter, actually quiet parameter is for the process, that means user won't be able to see the installation process of updating but they will notify for the reboot anyway which is part of the windows feature updater. 

  • Jon Harwood
    Jon Harwood Member
    edited September 2019

    Reza - It doesn't notify the user and just reboots, I have run it on my own test machine and there was no warning at all.

  • Reza Gholami
    Reza Gholami Member
    edited September 2019

    Are you sure? You didn't miss it? because it reboots automatically after 30 minutes.

    Now questions are, did it update it to 1903? Did it even reboot at all after you ran the script?

  • Jon Harwood
    Jon Harwood Member
    edited September 2019

    Hi Reza, perfectly sure and yes it did update. We have also had users tell us the same thing. 

    Can you set it to prompt the user to reboot rather than forcing a reboot after 30 minutes which is what happens if you run it from MS.

  • Jonathon Nash
    Jonathon Nash Member
    edited September 2019

    I'm not "Jon Harwood" and I can confirm it does successfully update to 1903 and abruptly restarts the computer without giving the users any warning.

  • Reza Gholami
    Reza Gholami Member
    edited September 2019

    Hi Jon and Jonathon, It's weird because that reboot part is built in to that updater! and it should notify user with 30 minutes count down. 

    There is no immediately reboot in the script.  

  • Jonathon Nash
    Jonathon Nash Member
    edited September 2019
    I'm not sure if there is a fix or not. If the process is not running as the user, the restart warning prompt doesn't come up.
  • Reza Gholami
    Reza Gholami Member
    edited September 2019

    There is no restart or warning if it doesn't run the updater or if it runs but fails for any reason. 


  • Aaron Trandem
    Aaron Trandem Member CHOCOLATE MILK
    edited September 2019

    I'm finding that the update auto reboots and the 30 minutes of wait time to reboot isn't happening. Overall the installation takes about an hour but the script doesn't fully complete for another 2 or more after, skipping the reboot and then it will eventually delete the folder and objects inside it. Is anyone else getting similar results?

  • Brian Gottshall
    edited October 2019

    Just an FYI, if you run this on a Windows 7 machine, it upgrades it to Windows 10, 1903...

  • Jani Neuvonen
    Jani Neuvonen Member
    edited October 2019

    I've been using /NoReboot switch so that it does not force reboot but this has stopped working recently so I think MS updated the Update Assistant and removed that option for some reason. Here's all the switches I use: /QuietInstall /SkipEULA /NoReboot /UninstallUponUpgrade, the last one uninstalls the Update Assistant from the machine after the upgrade is done.

  • Tabrez Goilkar
    edited November 2019

    can we have option upgrade from share folder instead of Microsoft folder

  • Brandon Dube
    Brandon Dube Member
    edited November 2019

    Has anyone tried this to update to 1909 instead of 1903? it looks to me like the path to download the upgrade assistant now points to the 1909 version (probably done by ms).

Weekly Leaderboard