How to run a post script after a Windows 10 feature upgrade with SetupConfig.ini

If you are planning on upgrading your Windows 10 OS from 1607 to 1703 you may have noticed that a few apps have reappeared. Luckily for us, Microsoft has provided a way to add parameters to upgrades with the SetupConfig.ini file.

For example, you can create a Setupconfig.ini with the following:
Note that the header [SetupConfig] is required.

[SetupConfig]
NoReboot
ShowOobe=None
Telemetry=Enable

This is equivalent to the following command line:

Setup.exe /NoReboot /ShowOobe None /Telemetry Enable

How does the upgrade use the SetupConfig.ini file?
If the update is delivered through Windows Update, Windows Setup searches in a default location for a setupconfig file. You can include the setupconfig file here:
“%systemdrive%\Users\Default\AppData\Local\Microsoft\Windows\WSUS\SetupConfig.ini”

How do you run a post script?
You can easily add a post script by adding the PostOOBE parameter to the SetupConfig file as shown below:

[SetupConfig]
PostOOBE=C:\SetupComplete.cmd

How do you run a Powershell script?
The only way that I have been able to run a Powershell script is by running it from the .cmd file that I have called using the PostOOBE parameter.

Inside of the cmd file, you would have to add the following command to launch a Powershell script:

Powershell.exe -ExecutionPolicy Bypass -File "C:\Scripts\Remove-Apps-1703.ps1" -WindowStyle Hidden

I hope this post helps you understand the power of this ini file. Feel free to leave any questions in the comments and stay tuned for the cleanup script that I am currently working on!

UPDATE: The post clean up script can be found here!

10 Comments

  1. Dude! I like this! How do you guys deploy feature updates- do you use servicing plans in SCCM?

    https://docs.microsoft.com/en-us/windows/deployment/update/waas-manage-updates-configuration-manager

    • Jose Espitia

      Thanks! At the moment we’re using WSUS to deploy updates and feature upgrades (That will be changing in the near future).

      I believe you can use the SetupConfig.ini with SCCM if you plan on not using the Task Sequence to deploy an upgrade.

  2. Hi
    I have this setup, but upon reboot it doenst run the powershell because its waiting for a prompt then times out


    Run only scripts that you trust, etc

    So I have to manually run it with “run once”, do you know how to pass that as a command in the cmd file

  3. Have you finally tried with SCCM and features upgrade with serviccing?

  4. Hi,

    Just wanted to stop by and thank you!

    The script (modified, removed everything except the Remove Apps part) works flawlessly with Windows Servicing in SCCM v.1710. Went from Windows 10 v.1703 to v.1709. Testing the same but from v.1607 to v.1709 now.

  5. Most execellent! Been looking for something to acheive this, thank you!

Leave a Reply