Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looping while install disk initialises #1516

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions cli_tools/gce_windows_upgrade/upgrade_script_2008r2_to_2012r2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,19 @@ online disk noerr
}

# Find the drive which contains install media.
$Drives = Get-WmiObject Win32_LogicalDisk
ForEach ($Drive in $Drives) {
if (Test-Path "$($Drive.DeviceID)\Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English") {
$script:install_media_drive = "$($Drive.DeviceID)"
For ($i=0; $i -lt 5; $i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting at 1 helps with the output

Suggested change
For ($i=0; $i -lt 5; $i++) {
For ($i=1; $i -le 5; $i++) {

$Drives = Get-WmiObject Win32_LogicalDisk
ForEach ($Drive in $Drives) {
if (Test-Path "$($Drive.DeviceID)\Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English") {
$script:install_media_drive = "$($Drive.DeviceID)"
}
}
if ($script:install_media_drive){break}
camedk marked this conversation as resolved.
Show resolved Hide resolved
Write-Host "Disk not ready yet - waiting"
camedk marked this conversation as resolved.
Show resolved Hide resolved
Start-Sleep -Seconds 5
}


if (!$script:install_media_drive) {
throw "No install media found."
camedk marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down