I am attempting to run the following code to retrieve a list of local users on a machine.
gwmi win32_useraccount -Computername $env:computername -Filter "Domain='$env:computername'" |
Format-Table Name,Description
I get this error when running inside a PS1 file:
The object of type
"Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not
valid or not in the correct sequence. This is likely caused by a
user-specified "f ormat-table" command which is conflicting with the
default formatting.
+ CategoryInfo : InvalidData: (:) [out-lineoutput],
InvalidOperationException
+ FullyQualifiedErrorId :
ConsoleLineOutputOutOfSequencePacket,Microsoft.PowerShell.Commands.OutLineOutputCommand
I understand this issue arises because of the way the pipelines are parsed but I can't figure out how to get around it.