0

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?

cmm user
  • 2,426
  • 7
  • 34
  • 48

1 Answers1

0

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

Paul
  • 5,524
  • 1
  • 22
  • 39