Last active
June 13, 2019 10:17
-
-
Save systemcenterblog/9c2737f000a2373a5815785d6e33337d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Parameters SetupConfig.ini | |
[string] $PPriorityValue = 'High' | |
[string] $PostOOBEValue = 'C:\ProgramData\OSConfig\setupcomplete.cmd' | |
[string] $Value3 = 'powershell.exe -executionpolicy bypass -file C:\ProgramData\OSConfig\Background\Set-Background.ps1' | |
[string] $Value2 = 'powershell.exe -executionpolicy bypass -file C:\ProgramData\OSConfig\Start\Set-StartLayout.ps1' | |
[string] $Value = 'MsiExec.exe /X {F14000BE-0001-6400-0000-074957833700} /qn' | |
#Variable for ini file path | |
$iniFilePath = "$env:SystemDrive\Users\Default\AppData\Local\Microsoft\Windows\WSUS\SetupConfig.ini" | |
$FilePath = "$env:SystemDrive\ProgramData\OSConfig\SetupComplete.cmd" | |
#Variables for SetupConfig | |
$iniSetupConfigSlogan = "[SetupConfig]" | |
$iniSetupConfigKeyValuePair =@{"PostOOBE"=$PostOOBEValue;"Priority"=$PPriorityValue;} | |
#Variables for SetupComplete | |
$ConfigKeyValuePair =@{"Value"=$Value;"Value2"=$Value2;"Value3"=$Value3} | |
#Init SetupConfig content | |
$iniSetupConfigContent = @" | |
$iniSetupConfigSlogan | |
"@ | |
#Init SetupComplete content | |
$ConfigContent = @" | |
"@ | |
#Build SetupConfig content with settings | |
foreach ($k in $iniSetupConfigKeyValuePair.Keys) | |
{ | |
$val = $iniSetupConfigKeyValuePair[$k] | |
$iniSetupConfigContent = $iniSetupConfigContent.Insert($iniSetupConfigContent.Length, "`r`n$k=$val") | |
} | |
#Build SetupComplete content with settings | |
foreach ($k in $ConfigKeyValuePair.values) | |
{ | |
$val = $iniSetupConfigKeyValuePair[$k] | |
$ConfigContent = $ConfigContent.Insert($ConfigContent.Length, "`r`n$k") | |
} | |
#Write content to file | |
New-Item $FilePath -ItemType File -Value $ConfigContent -Force | |
New-Item $iniFilePath -ItemType File -Value $iniSetupConfigContent -Force | |
New-Item 'HKLM:\SOFTWARE\COMPANYNAME\FeatureUpgrade\1809Ready' -force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment