Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewige committed Dec 17, 2024
1 parent 91f3a84 commit dfedb27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 1es/Setup_orig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ for ($i = 0; $i -lt $vhds.Count; $i++) {

Log-Message "VM $vmName created successfully"
} catch {
Log-Message "Failed to create VM $vmName: $_"
Log-Message "Failed to create VM $vmName with error $_"
}
}

Expand Down
17 changes: 8 additions & 9 deletions 1es/prepare_vm_helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Create-DirectoryIfNotExists {
throw "Failed to create directory: $Path"
}
} catch {
throw "Failed to create directory: $Path. $_"
throw "Failed to create directory: $Path with error $_"
}
}

Expand Down Expand Up @@ -77,7 +77,7 @@ function Execute-CommandOnVM {

Log-Message -Message "Executed command on VM: $VMName. Command: $Command. Result: $result"
} catch {
throw "Failed to execute command on VM: $VMName. Error: $_"
throw "Failed to execute command on VM: $VMName with error: $_"
}
}

Expand Down Expand Up @@ -203,7 +203,7 @@ function Create-VM {

Log-Message -Message "Successfully created VM: $VMName" -ForegroundColor Green
} catch {
throw "Failed to create VM: $VmName. Error: $_"
throw "Failed to create VM: $VmName with error: $_"
}
}

Expand Down Expand Up @@ -268,7 +268,7 @@ function Configure-VM {

Log-Message "Successfully configured VM: $VmName" -ForegroundColor Green
} catch {
throw "Failed to configure VM: $VmName. Error: $_"
throw "Failed to configure VM: $VmName with error: $_"
}
}

Expand All @@ -286,7 +286,7 @@ function Install-HyperVIfNeeded {
exit 1
}
} catch {
throw "Failed to install Hyper-V: $_"
throw "Failed to install Hyper-V with error: $_"
}
}

Expand Down Expand Up @@ -317,7 +317,7 @@ function Create-VMSwitchIfNeeded {
New-VMSwitch -Name $switchName -NetAdapterName $NetAdapterName -AllowManagementOS $true
# break
} catch {
Log-Message "Failed to create external switch for NetAdapter: $NetAdapterName $_"
Log-Message "Failed to create external switch for NetAdapter: $NetAdapterName with error: $_"
}
}
} elseif ($SwitchType -eq 'Internal') {
Expand All @@ -335,7 +335,7 @@ function Create-VMSwitchIfNeeded {
throw "Invalid switch type: $SwitchType"
}
} catch {
throw "Failed to create external switch: $_"
throw "Failed to create external switch with error: $_"
}
}

Expand All @@ -351,7 +351,6 @@ function Create-VMStoredCredential {

New-StoredCredential -Target $CredentialName -UserName $Username -Password $Password -Type Generic -Persist LocalMachine
} catch {
Log-Message "Failed to create stored credential: $_" -ForegroundColor Red
# throw "Failed to create stored credential: $_"
Log-Message "Failed to create stored credential with error $_" -ForegroundColor Red
}
}

0 comments on commit dfedb27

Please sign in to comment.