Skip to content

Commit

Permalink
Fix Role not passed to remote node (#377)
Browse files Browse the repository at this point in the history
# Description
Summary of changes:
- Fix how Role is passed to remote computer

# Change type
- [x] Bug fix (non-breaking change)
- [ ] Code style update (formatting, local variables)
- [ ] New Feature (non-breaking change that adds new functionality
without impacting existing)
- [ ] Breaking change (fix or feature that may cause functionality
impact)
- [ ] Other

# Checklist:
- [x] My code follows the style and contribution guidelines of this
project.
- [x] I have tested and validated my code changes.
  • Loading branch information
arudell authored Jan 30, 2025
1 parent 5fe930c commit 3d7a05a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/modules/SdnDiag.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,23 @@ function Start-SdnNetshTrace {
$Credential = [System.Management.Automation.PSCredential]::Empty
)

$scriptBlock = {
param(
[Parameter(Position = 0)][String]$Role,
[Parameter(Position = 1)][String]$OutputDirectory,
[Parameter(Position = 2)][int]$MaxTraceSize,
[Parameter(Position = 3)][String]$Capture,
[Parameter(Position = 4)][String]$CaptureType,
[Parameter(Position = 5)][String]$Overwrite,
[Parameter(Position = 6)][String]$Report,
[Parameter(Position = 7)][String]$Correlation,
[Parameter(Position = 8)][String]$Providers
)

Start-SdnNetshTrace -Role $Role -OutputDirectory $OutputDirectory `
-MaxTraceSize $MaxTraceSize -Capture $Capture -CaptureType $CaptureType -Overwrite $Overwrite -Report $Report -Correlation $Correlation -Providers $Providers
}

$traceParams = @{
OutputDirectory = $OutputDirectory
MaxTraceSize = $MaxTraceSize
Expand All @@ -2178,8 +2195,8 @@ function Start-SdnNetshTrace {

try {
if ($PSCmdlet.ParameterSetName -eq 'Remote') {
$traceParams.Add('Role', $Role)
Invoke-PSRemoteCommand -ComputerName $ComputerName -Credential $Credential -ScriptBlock { Start-SdnNetshTrace } -ArgumentList $traceParams
Invoke-PSRemoteCommand -ComputerName $ComputerName -Credential $Credential -ScriptBlock $scriptBlock `
-ArgumentList @($Role, $traceParams.OutputDirectory, $traceParams.MaxTraceSize, $traceParams.Capture, $traceParams.CaptureType, $traceParams.Overwrite, $traceParams.Report, $traceParams.Correlation, $Providers)
}
else {
$traceProviderString = Get-TraceProviders -Role $Role -Providers $Providers -AsString
Expand Down

0 comments on commit 3d7a05a

Please sign in to comment.