Not sure but the powershell.invoke
output looks like an object-output via write-host
and the pipeline.invoke
looks like write-output
output even though both should return a psobject.
More code would be helpful
The result of same script is displayed in two formats while calling using powershell.invoke and pipeline.invoke
-
23-09-2022 - |
Pergunta
I am calling following script to display the local user accounts in a machine :
$adsi = [ADSI]'WinNT://localhost';
$adsi.Children | where {$_.SchemaClassName -eq 'user'} |Select-Object @{n='UserName';e={$_.Name}};
When the above script is executed using powershell.invoke, the result is
@{UserName=account17}
When the same script is executed using pipeline.invoke, the result is :
UserName
--------
account17
Why is there a difference in the output for the same script when invoked using powershell and pipeline?
Nenhuma solução correta
Outras dicas
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow