How can I in-place upgrade to Windows 10 1803 using Powershell App Deployment Toolkit and SCCM (System Center Configuration Manager)

Introduction

Update July 26, 2018: I have made an update to below content. Please find the new post on the link below. Note that the content in this post is still relevant.

Windows 10 1803 is out (old news I know). Nevertheless, its always a good idea to be ahead and start thinking and planning the upgrade of your environment. Configuration Manager offers a lot of flexibility in terms of servicing plans and the use of task sequences.

Task sequences is the preferred method in our environment, and I thought I’d share how you can deploy the Windows 10 1803 upgrade through the Powershell App Deployment Toolkit, some custom Powershell script and an application in the Configuration Manager Software Center. Curious? Read on. 🙂

1. Powershell App Deployment Toolkit

I’m not going into super details about the Powershell App Deployment Toolkit (PSADT), but will instead just provide you with a copy of the complete toolkit including my modifications for download: PSADT_1803Upgrade.zip (406 downloads)

There are a few changes to it worth mentioning,  so here goes:

  • The installation has to happen as the currently logged on user and run in such context, therefore does the PSADT not require administrative rights (changed in AppDeployToolkitConfig.xml)
    • As of such, the registry path where the toolkit stores information changed to HKCU from HKLM (changed in AppDeployToolkitConfig.xml)
  • No balloon notifications (changed in AppDeployToolkitConfig.xml)
  • Slightly modified Show-InstallationPrompt to support cancellation of the deployment and line breaks of the message displayed
  • PSADT is running my custom powershell script explained in the next section (not included in the download on purpose)

2. Custom Powershell Script

This is actually where the most of the magic happens. This is the script you have to put into the Files folder of the Powershell App Deployment Toolkit. I left it out on purpose, forcing whoever to use this approach, to take a closer look on what’s happening. I will explain along the lines what’s happening inside the script. Note that it’s still referring to my stuff (nothing secret). Change accordingly.

Copy/paste and save the script as Execute-OSUpgrade.ps1 and put into the Files folder.

In short the script does following:

  • Loads the Write-Log function
  • Loads the Software Center as the currently logged on user
  • Retrieves the upgrade task sequence
  • Executes the upgrade task sequence
  • Writes to registry and logfile

3. Configuration Manager

Next up is the application in Configuration Manager. Create a new application following below screenshots and instructions. (This is based off my edition of the PSADT and above Powershell script)

  • Manually specify the application information and click Next

  • Give the application a name and fill out as your desire and click Next

  • Specify details for the Software Center and select an icon

  • Add a new deployment type

  • Select Script Installer from the drop down menu and click Next

  • Give the Deployment Type a name and click Next

  • Specify the Content location and Installation program as shown above

  • Add a Detection Method on Add Clause

  • The detection method is going to be Registry and will point to the registry key made by the Execute-OSUpgrade.ps1 script. Modify to suit your changes

  • Make sure that the application has an application installation behavior as Install for user. Finish the wizard on Next.

Deployment

It goes without saying, but the application you just created and the upgrade task sequence intended to run, needs to be deployed (both as available in this scenario).

This is all basic Configuration Manager, so I’m not going into details here. For your reference, the application is being deployed to a collection consisting of users, whereas the task sequence is being deployed to a collection consisting of computers. Key here is, that the task sequence is available for the users deploying the application. If the task sequence isn’t available, the installation of the application running the script, will fail.

Your Software Center basically have to have both the application AND the task sequence shown as available. Something similar to this view:

End user experience

This illustrates how the experience is from an end users point of view.

  1. Manually clicking on the application in the Software Center (this can of course be a required deployment as well with a set deadline)
  2. Powershell App Deployment toolkit running with the chosen options
  3. Execute-OSUpgrade.ps1 being executed
  4. The upgrade task sequence being run and Windows 10 being upgraded

Final words

Using the Powershell App Deployment Toolkit gives you several advantages in ability to deferral, checking for disk space, checking for presence of powersupply and battery and adds a lot more visibility for the end user. I will walk through my upgrade task sequence in an upcoming blog post.

Please share and leave a comment if this was useful.

References:

https://gallery.technet.microsoft.com/scriptcenter/Write-Log-PowerShell-999c32d0
www.psappdeploytoolkit.com/

18 thoughts on “How can I in-place upgrade to Windows 10 1803 using Powershell App Deployment Toolkit and SCCM (System Center Configuration Manager)”

    • Thanks! Unfortunately not. I’m in a Windows 10 only environment, but I don’t see why the script shouldn’t work on Windows 7 as well 🙂

  1. Just to add on this wonderful blogpost. The PS App Dep Toolkit has builtin check to ensure the the computer has a power adapter attached and it’s has a LAN/wired connection. However, the “Test-NetworkConnection” isn’t always super reliable – so test in your own environment.

    Code if needed (sorry for the spaghetti):

    #Test if virtual machine
    $ModelType = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model

    if($ModelType -ne “Virtual Machine”){
    ##
    #Check for power connected
    Test-Battery
    $testbat = Test-Battery
    if(!$testbat){
    Show-InstallationPrompt -Title ‘Strømstik mangler’ -Message “Installationen kunne ikke finde et tilsluttet Strømstik.nnTilslut venligst et Strømstik og tryk: Prøv igen” -Icon ‘Exclamation’ -Timeout 300 -MinimizeWindows $True -MessageAlignment Left -ButtonRightText ‘Prøv igen’
    $testbat2 = Test-Battery
    if(!$testbat2){
    Show-InstallationPrompt -Title ‘Strømstik mangler’ -Message “Installationen kunne igen ikke finde et tilsluttet Strømstik.nnOpgraderingen afbrydes.” -Icon ‘Exclamation’ -Timeout 300 -MinimizeWindows $True -MessageAlignment Left -ButtonRightText ‘Øv’
    exit
    }
    }
    # Check for wired-network
    Test-NetworkConnection
    $testnet = Test-NetworkConnection
    if(!$testnet){
    Show-InstallationPrompt -Title ‘Netværkskabel mangler’ -Message “Installationen kunne ikke finde et tilsluttet netværkstik.nnTilslut venligst et netværkstik og tryk: Prøv igen” -Icon ‘Exclamation’ -Timeout 300 -MinimizeWindows $True -MessageAlignment Left -ButtonRightText ‘Prøv igen’
    $testnet2 = Test-NetworkConnection
    if(!$testnet2){
    Show-InstallationPrompt -Title ‘Netværkskabel mangler’ -Message “Installationen kunne igen ikke finde et tilsluttet netværkstik.nnOpgraderingen afbrydes.” -Icon ‘Exclamation’ -Timeout 300 -MinimizeWindows $True -MessageAlignment Left -ButtonRightText ‘Øv’
    exit
    }
    }
    }

  2. Great blog.
    One thing I would change is the registry tattooing. I would create that registry key at the end of the task sequence if this was successful. In this way you can re-run the application if the TS fails to upgrade the OS.

    • That’s actually not a bad idea. I think I came across that myself but hated that the application will fail. I might reconsider actually. Thanks 🙂

  3. Hello,

    First thanks you this very great tool for the upgrade in place.

    In your video, i see “Windows is beiing upgraded ..” in full screen. I try to create this in XAML but it’s very difficult for me.

    Can you please share this code ? save me a lot of time for my project.

    Thanks you very much in advance and sorry for my english i’m french.

  4. You create the PSAD as a application and in the box you say ‘if you click No it will retry in 2 hours’. It’s not possible to rerun an application at a set schedule of 2 hours so how did you get the 2 hours to work? Is 2 hours the period in which SCCM checks if a required application is installed and if not retries the installation and thus shows the PSAD again?

    Also… if a user refuses to attach the power adapter nothing actually happens after clicking retry and OK. Isn’t it possible to create an infinity retry loop?

    • The retry behavior with the application model should retry the installation if it fails with error code 1618

  5. I noticed when reading the updated blog. Thanks for the quick answer. We’ve been using the PSAD for quite a while now but I never thought of using it in ways like this. For our IPU we use OneVinn’s Windows 10 Upgrade Tools, but we ran into some challenges with systems not using the power adapter. Your post was of great use. Just trying to find a way to combine it all.

  6. A few days ago I asked if the check for the Power Adapter could be an infinity loop that the user couldn’t escape by just clicking Try Again or OK. With this code the Messagebox will keep popping up until the user really attaches a power adapter. No escape possible unless the user kills the running task.

    #Check for connected power adapter
    if($ModelType -ne “Virtual Machine”) {

    Do {
    $Testbat = Test-Battery

    If(!$Testbat) {
    Show-InstallationPrompt -Title ‘Power adapter missing!’ -Message “The installation was unable to find an attached power adapter.nnPlease attach a power adapter and click try again” -Icon ‘Exclamation’ -Timeout 300 -MinimizeWindows $True -MessageAlignment Left -ButtonRightText ‘Try Again’

    }
    }
    Until($Testbat)
    }

    Credits to you for giving me the idea to use the PSAD Toolkit and to José Espitia for showing me how to correctly script a Do – Until loop. I am by no means a Powershell Guru 🙂

    In our IPU I’ve implemented a step which checks if the system is running without power attached and if so it pops up a messagebox. The user can only continue with the IPU by attaching the power cord. Works like a charm.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.