Skip to content

always collect Get-NetView in secnetperf #5088

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

Merged
merged 2 commits into from
May 9, 2025
Merged
Changes from 1 commit
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
28 changes: 15 additions & 13 deletions scripts/secnetperf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ if (!($Session -eq "NOT_SUPPORTED")) {
}

# Collect some info about machine state.
if (!$NoLogs -and $isWindows -and !($Session -eq "NOT_SUPPORTED")) {
if (!$NoLogs -and $isWindows) {
$Arguments = "-SkipNetsh"
if (Get-Help Get-NetView -Parameter SkipWindowsRegistry -ErrorAction Ignore) {
$Arguments += " -SkipWindowsRegistry"
Expand All @@ -224,18 +224,20 @@ if (!$NoLogs -and $isWindows -and !($Session -eq "NOT_SUPPORTED")) {
} catch { Write-Host $_ }
Write-Host "::endgroup::"

Write-Host "::group::Collecting information on peer machine state"
try {
Invoke-Command -Session $Session -ScriptBlock {
Invoke-Expression "Get-NetView -OutputDirectory $Using:RemoteDir/artifacts/logs $Using:Arguments"
Remove-Item $Using:RemoteDir/artifacts/logs/msdbg.$env:COMPUTERNAME -recurse
$filePath = (Get-ChildItem -Path $Using:RemoteDir/artifacts/logs/ -Recurse -Filter msdbg.$env:COMPUTERNAME*.zip)[0].FullName
Rename-Item $filePath "get-netview.peer.zip"
}
Copy-Item -FromSession $Session -Path "$RemoteDir/artifacts/logs/get-netview.peer.zip" -Destination ./artifacts/logs/
Write-Host "Generated get-netview.peer.zip"
} catch { Write-Host $_ }
Write-Host "::endgroup::"
if ($Session -ne "NOT_SUPPORTED") {
Write-Host "::group::Collecting information on peer machine state"
try {
Invoke-Command -Session $Session -ScriptBlock {
Invoke-Expression "Get-NetView -OutputDirectory $Using:RemoteDir/artifacts/logs $Using:Arguments"
Remove-Item $Using:RemoteDir/artifacts/logs/msdbg.$env:COMPUTERNAME -recurse
$filePath = (Get-ChildItem -Path $Using:RemoteDir/artifacts/logs/ -Recurse -Filter msdbg.$env:COMPUTERNAME*.zip)[0].FullName
Rename-Item $filePath "get-netview.peer.zip"
}
Copy-Item -FromSession $Session -Path "$RemoteDir/artifacts/logs/get-netview.peer.zip" -Destination ./artifacts/logs/
Write-Host "Generated get-netview.peer.zip"
} catch { Write-Host $_ }
Write-Host "::endgroup::"
}
}

$json = @{}
Expand Down
Loading