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!
Matt
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.
John Paul
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
Jose Espitia
Try running the Powershell script with the following command:
Powershell.exe -ExecutionPolicy Bypass -File "C:\Scripts\Remove-Apps-1703.ps1" -WindowStyle Hidden
According to this MS article, that should fix your problem:
https://blogs.technet.microsoft.com/christwe/2012/09/20/but-i-ran-set-executionpolicy-unrestricted-what-is-going-on/
Fred
Have you finally tried with SCCM and features upgrade with serviccing?
Jose Espitia
Yes, I have a few people that have confirmed that the setupconfig.ini will work with servicing plans in SCCM.
Fred
Ok, it’s working now with SCCM and servicing.
Thanks!
Navneet
Hello Fred, How do you use in SCCM? Is it using task sequence or using the same location mentioned in article? I am also using SCCM and need to run few powershell commands before and after the feature updates.
P-H
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.
Jose Espitia
That’s great to hear! I’m glad that this worked out for you 🙂
Jake
Most execellent! Been looking for something to acheive this, thank you!