UNCLASSIFIED

Skip to content
Snippets Groups Projects
Commit c3212a82 authored by Christophe Campbell's avatar Christophe Campbell
Browse files

Modified custom scripts so that the installs only run once. Added -Force to...

Modified custom scripts so that the installs only run once.  Added -Force to Set-WSManQuickConfig to fix error about running PS in non-interactive mode.  Added some debugging echos to help troubleshoot.
parent 7e8d47d4
Branches
2 merge requests!3Resolve "Issue with RunAfterWindowsUpdates script in windows 7 build.",!2WIP: Resolve "Issue with RunAfterWindowsUpdates script in windows 7 build."
Write-Host "BEGIN RunAfterUpdates"
if (!(Test-Path C:\UnattendResources\CustomResources\PS7.done))
{
Write-Host "Installing PS 7"
Invoke-Expression "& { $(Invoke-Restmethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"
$null > C:\UnattendResources\CustomResources\PS7.done
Write-Host "Done Installing PS 7"
}
Set-WSManQuickConfig
if (!(Test-Path C:\UnattendResources\CustomResources\ANS.done))
{
Write-Host "Config winrm for ansible"
Set-WSManQuickConfig -Force
$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))
(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
powershell.exe -ExecutionPolicy ByPass -File $file
#iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))
$null > C:\UnattendResources\CustomResources\ANS.done
Write-Host "Done Config winrm for ansible"
}
Write-Host "END RunAfterUpdates"
Start-Sleep -s 15
Write-Host "BEGIN RunBeforeUpdates"
if (!(Test-Path C:\UnattendResources\CustomResources\UCR.done))
{
Write-Host "Installing Universal C Runtime "
Start-Process wusa.exe "C:\UnattendResources\CustomResources\Windows6.1-KB3118401-x64.msu /quiet /norestart" -Wait
$null > C:\UnattendResources\CustomResources\UCR.done
Write-Host "Done Installing Universal C Runtime"
}
if (!(Test-Path C:\UnattendResources\CustomResources\DOTNET.done))
{
Write-Host "Installing .Net 4.5.2"
$env:SEE_MASK_NOZONECHECKS = 1
Start-Process -FilePath "C:\UnattendResources\CustomResources\NDP452-KB2901907-x86-x64-AllOS-ENU.exe" -Argumentlist "/q /norestart" -Wait
Write-Host "Insalling WMF and Powershell 5.1"
$null > C:\UnattendResources\CustomResources\DOTNET.done
Write-Host "Done Installing .Net 4.5.2"
}
if (!(Test-Path C:\UnattendResources\CustomResources\WMFPS.done))
{
Write-Host "Installing WMF and Powershell 5.1"
Start-Process wusa.exe "C:\UnattendResources\CustomResources\Win7AndW2K8R2-KB3191566-x64.msu /quiet" -Wait
$null > C:\UnattendResources\CustomResources\WMFPS.done
Write-Host "Done Installing WMF and Powershell 5.1"
}
Write-Host "END RunBeforeUpdates"
Start-Sleep -s 10
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment