Skip to content

Commit 99a6724

Browse files
committed
Added "InstallCloudbaseInit" switch to the script
One can select if Cloudbase-Init is also installed by adding -InstallCloudbaseInit option.
1 parent d82a560 commit 99a6724

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

UpdateAndSysprep.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Param(
2+
[switch]$InstallCloudbaseInit
3+
)
14
$ErrorActionPreference = "Stop"
25

36
Get-WUInstall -AcceptAll -IgnoreReboot
@@ -9,6 +12,13 @@ else
912
{
1013
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name Unattend*
1114
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoLogonCount
12-
Start-Process -FilePath msiexec -ArgumentList "/i C:\Windows\Temp\CloudbaseInitSetup.msi /qn /l*v C:\Windows\Temp\CloudbaseInitSetup_Beta.log" -Wait
13-
C:\Windows\System32\Sysprep\Sysprep.exe /generalize /oobe /shutdown /unattend:C:\Windows\Temp\Unattend.xml
15+
if($InstallCloudbaseInit)
16+
{
17+
Start-Process -FilePath msiexec -ArgumentList "/i C:\Windows\Temp\CloudbaseInitSetup.msi /qn /l*v C:\Windows\Temp\CloudbaseInitSetup_Beta.log" -Wait
18+
C:\Windows\System32\Sysprep\Sysprep.exe /generalize /oobe /shutdown /unattend:C:\Program\ Files\ (x86)\Cloudbase\ Solutions\Cloudbase-Init\conf\Unattend.xml
19+
}
20+
else
21+
{
22+
C:\Windows\System32\Sysprep\Sysprep.exe /generalize /oobe /shutdown /unattend:C:\Windows\Temp\Unattend.xml
23+
}
1424
}

0 commit comments

Comments
 (0)