Skip to content

Commit c2dc7b1

Browse files
authored
fix legacy command resolution on win ps 5.1 (#1882)
1 parent e73e956 commit c2dc7b1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Authentication/Authentication/custom/Find-MgGraphCommand.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,11 @@ Function Find-MgGraphCommand {
127127
}
128128

129129
# Resolve legacy commands.
130-
[array]$ResolvedCommands = [Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance.MgLegacyCommandMapping | Where-Object LegacyMapping -Contains $Command | Select-Object -ExpandProperty Command
131-
if (!$ResolvedCommands) {
130+
[array]$ResolvedCommands = [Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance.MgLegacyCommandMapping | Where-Object LegacyMapping -Contains $Command
131+
if ($ResolvedCommands) {
132+
$ResolvedCommands = $ResolvedCommands.Command
133+
}
134+
else {
132135
$ResolvedCommands = $Command
133136
}
134137
Write-Debug "Resolved Command: $ResolvedCommands"

0 commit comments

Comments
 (0)