Skip to content

Commit 70c3038

Browse files
committed
Fix Select-Object with Property = '*'
1. Now ExcludeProperty imply Property = '*' 2. Don't return property named '*'
1 parent 42fe5b8 commit 70c3038

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Microsoft.PowerShell.Commands.Utility/commands/utility/select-object.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ private void ProcessExpressionParameter()
337337
if (ExcludeProperty != null)
338338
{
339339
_exclusionFilter = new MshExpressionFilter(ExcludeProperty);
340+
if ((Property == null) || (Property.Length == 0))
341+
{
342+
Property = new Object[]{"*"};
343+
_propertyMshParameterList = processor.ProcessParameters(Property, invocationContext);
344+
}
340345
}
341346
}
342347

@@ -414,7 +419,7 @@ private void ProcessParameter(MshParameter p, PSObject inputObject, List<PSNoteP
414419
}
415420
}
416421

417-
if (expressionResults.Count == 0)
422+
if (expressionResults.Count == 0 && !ex.HasWildCardCharacters)
418423
{
419424
//Commented out for bug 1107600
420425
//if (!ex.HasWildCardCharacters)

0 commit comments

Comments
 (0)