Skip to content

Commit 5e9f0d6

Browse files
authored
always collect get-netview in secnetperf (#5088)
1 parent 54ced5e commit 5e9f0d6

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

scripts/secnetperf.ps1

+19-15
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,18 @@ if (!($Session -eq "NOT_SUPPORTED")) {
196196
Copy-Item -ToSession $Session ./artifacts -Destination "$RemoteDir/artifacts" -Recurse
197197
Copy-Item -ToSession $Session ./scripts -Destination "$RemoteDir/scripts" -Recurse
198198
Copy-Item -ToSession $Session ./src/manifest/MsQuic.wprp -Destination "$RemoteDir/scripts"
199+
}
199200

200-
# Create the logs directories on both machines.
201-
New-Item -ItemType Directory -Path ./artifacts/logs | Out-Null
201+
# Create the logs directories on both machines.
202+
New-Item -ItemType Directory -Path ./artifacts/logs | Out-Null
203+
if ($Session -ne "NOT_SUPPORTED") {
202204
Invoke-Command -Session $Session -ScriptBlock {
203205
New-Item -ItemType Directory -Path $Using:RemoteDir/artifacts/logs | Out-Null
204206
}
205207
}
206208

207209
# Collect some info about machine state.
208-
if (!$NoLogs -and $isWindows -and !($Session -eq "NOT_SUPPORTED")) {
210+
if (!$NoLogs -and $isWindows) {
209211
$Arguments = "-SkipNetsh"
210212
if (Get-Help Get-NetView -Parameter SkipWindowsRegistry -ErrorAction Ignore) {
211213
$Arguments += " -SkipWindowsRegistry"
@@ -224,18 +226,20 @@ if (!$NoLogs -and $isWindows -and !($Session -eq "NOT_SUPPORTED")) {
224226
} catch { Write-Host $_ }
225227
Write-Host "::endgroup::"
226228

227-
Write-Host "::group::Collecting information on peer machine state"
228-
try {
229-
Invoke-Command -Session $Session -ScriptBlock {
230-
Invoke-Expression "Get-NetView -OutputDirectory $Using:RemoteDir/artifacts/logs $Using:Arguments"
231-
Remove-Item $Using:RemoteDir/artifacts/logs/msdbg.$env:COMPUTERNAME -recurse
232-
$filePath = (Get-ChildItem -Path $Using:RemoteDir/artifacts/logs/ -Recurse -Filter msdbg.$env:COMPUTERNAME*.zip)[0].FullName
233-
Rename-Item $filePath "get-netview.peer.zip"
234-
}
235-
Copy-Item -FromSession $Session -Path "$RemoteDir/artifacts/logs/get-netview.peer.zip" -Destination ./artifacts/logs/
236-
Write-Host "Generated get-netview.peer.zip"
237-
} catch { Write-Host $_ }
238-
Write-Host "::endgroup::"
229+
if ($Session -ne "NOT_SUPPORTED") {
230+
Write-Host "::group::Collecting information on peer machine state"
231+
try {
232+
Invoke-Command -Session $Session -ScriptBlock {
233+
Invoke-Expression "Get-NetView -OutputDirectory $Using:RemoteDir/artifacts/logs $Using:Arguments"
234+
Remove-Item $Using:RemoteDir/artifacts/logs/msdbg.$env:COMPUTERNAME -recurse
235+
$filePath = (Get-ChildItem -Path $Using:RemoteDir/artifacts/logs/ -Recurse -Filter msdbg.$env:COMPUTERNAME*.zip)[0].FullName
236+
Rename-Item $filePath "get-netview.peer.zip"
237+
}
238+
Copy-Item -FromSession $Session -Path "$RemoteDir/artifacts/logs/get-netview.peer.zip" -Destination ./artifacts/logs/
239+
Write-Host "Generated get-netview.peer.zip"
240+
} catch { Write-Host $_ }
241+
Write-Host "::endgroup::"
242+
}
239243
}
240244

241245
$json = @{}

0 commit comments

Comments
 (0)