Skip to content

Commit

Permalink
Ensure cscript output is written to log also use absolute paths (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkatyl authored Dec 11, 2024
1 parent 584c3ea commit 3617754
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions sysprep/activate_instance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,18 @@ function Activate-Instance {
}

# Set the KMS server.
& cscript //nologo $env:windir\system32\slmgr.vbs /skms $script:kms_server
& $env:windir\system32\cscript.exe //nologo $env:windir\system32\slmgr.vbs /skms $script:kms_server | ForEach-Object {
Write-Output $_
}
# Apply the license key to the host.
& cscript //nologo $env:windir\system32\slmgr.vbs /ipk $license_key
& $env:windir\system32\cscript.exe //nologo $env:windir\system32\slmgr.vbs /ipk $license_key | ForEach-Object {
Write-Output $_
}

Write-Output 'Activating instance...'
& cscript //nologo $env:windir\system32\slmgr.vbs /ato
& $env:windir\system32\cscript.exe //nologo $env:windir\system32\slmgr.vbs /ato | ForEach-Object {
Write-Output $_
}

while ($retry_count -gt 0) {
# Helps to avoid activation failures.
Expand All @@ -133,7 +139,9 @@ function Activate-Instance {
}
else {
Write-Output "Activation failed. Will try $retry_count more time(s)."
& cscript //nologo $env:windir\system32\slmgr.vbs /ato
& $env:windir\system32\cscript.exe //nologo $env:windir\system32\slmgr.vbs /ato | ForEach-Object {
Write-Output $_
}
}
}
}
Expand Down

0 comments on commit 3617754

Please sign in to comment.