Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit e5a36be

Browse files
committed
2 parents aa28904 + 129b1ff commit e5a36be

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.build.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,19 @@ task MoveLiveMountNetworkAddress {
188188
}
189189
$output = Invoke-VMScript @splat -ErrorAction Stop
190190
$splat = @{
191-
ScriptText = '(Get-NetAdapter| where {($_.MacAddress).ToLower() -eq "' + $TestInterfaceMAC + '"} | Get-NetIPAddress -AddressFamily IPv4).IPAddress'
191+
ScriptText = 'function Elevate-Process {
192+
param ([string]$exe = $(Throw "Pleave provide the name and path of an executable"),[string]$arguments)
193+
$startinfo = new-object System.Diagnostics.ProcessStartInfo
194+
$startinfo.FileName = $exe
195+
$startinfo.Arguments = $arguments
196+
$startinfo.verb = "RunAs"
197+
$process = [System.Diagnostics.Process]::Start($startinfo)
198+
}
199+
function QueryIP {
200+
Get-NetAdapter| where {($_.MacAddress).ToLower() -eq "' + $TestInterfaceMAC + '"}
201+
| Get-NetIPAddress -AddressFamily IPv4).IPAddress
202+
}
203+
Elevate-Process -Exe powershell.exe -Arguments "-noninteractive -command QueryIP > C:\rubrik.txt"'
192204
ScriptType = 'PowerShell'
193205
VM = $Config.virtualMachines[$i].mountName
194206
GuestCredential = $GuestCredential

0 commit comments

Comments
 (0)