Skip to content

Commit 6fb24e7

Browse files
committed
Change to BITS Transfer
1 parent 0a4c0ba commit 6fb24e7

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

VMScripts/Run-WVDHostOperations.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ param(
88
[Parameter(mandatory = $true)]
99
[string]$UpdateOnly
1010
)
11-
1211
$WVDMigrateInfraPath = "C:\WVDMigrate"
1312
$infraURI = "https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RWrmXv"
14-
15-
1613
if ($PreStageOnly -eq "T") {
1714
#Create folder for agent download
1815
try {
@@ -22,15 +19,14 @@ if ($PreStageOnly -eq "T") {
2219
catch {
2320
Write-Host "Unable to Create Directory Structure WVD Agent"
2421
}
25-
26-
#Download Current Version of WVD Agent
2722
$AssetstartDTM = (Get-Date)
28-
Invoke-WebRequest -Uri $infraURI -OutFile "$WVDMigrateInfraPath\Microsoft.RDInfra.RDAgent.Installer-x64.msi"
23+
#Download Current Version of WVD Agent
24+
#Invoke-WebRequest -Uri $infraURI -OutFile "$WVDMigrateInfraPath\Microsoft.RDInfra.RDAgent.Installer-x64.msi"
25+
Start-BitsTransfer -Source $infraURI -Destination "$WVDMigrateInfraPath\Microsoft.RDInfra.RDAgent.Installer-x64.msi"
2926
Write-Host "Downloaded RDInfra Agent"
3027
$AssetendDTM = (Get-Date)
3128
Write-Host "Agent Download Time: $(($AssetendDTM-$AssetstartDTM).totalseconds) seconds"
3229
}
33-
3430
if ($UpdateOnly -eq "T") {
3531
$tp = Test-Path -Path "C:\WVDMigrate\Microsoft.RDInfra.RDAgent.Installer-x64.msi" -PathType leaf
3632
if ($tp -eq $true) {
@@ -41,20 +37,17 @@ if ($UpdateOnly -eq "T") {
4137
Write-Host "Stopping migration process, please use -PreStageOnly parameter first on VM if using -UpdateOnly parameter"
4238
break
4339
}
44-
4540
#Remove Installed versions of WVD Agent
4641
Write-Host "Uninstalling any previous versions of RDInfra Agent on VM"
4742
$RDInfraApps = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq "Remote Desktop Services Infrastructure Agent" }
4843
foreach ($app in $RDInfraApps) {
4944
Write-Host "Uninstalling Infra Agent $app.Version"
5045
$app.Uninstall()
5146
}
52-
53-
$AgentInstaller = (dir $WVDMigrateInfraPath\ -Filter *.msi | Select-Object).FullName
47+
$AgentInstaller = (Get-ChildItem $WVDMigrateInfraPath\ -Filter *.msi | Select-Object).FullName
5448
$RegistrationToken = $HostPoolToken
5549
Write-Host "Starting install of $AgentInstaller"
5650
$agent_deploy_status = Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $AgentInstaller", "/quiet", "/qn", "/norestart", "/passive", "REGISTRATIONTOKEN=$RegistrationToken", "/l* $WVDMigrateInfraPath\AgentInstall.txt" -Wait -Passthru
5751
$sts = $agent_deploy_status.ExitCode
5852
Write-Host "Installing RD Infra Agent on VM Complete. Exit code=$sts"
59-
}
60-
53+
}

0 commit comments

Comments
 (0)