I am trying to convert a PowerShell cmdlet's output from a table view, into something more like an array. I used a list format to cut as much junk data as possible. Currently, I use the following code to get this output:
Get-AccountsWithUserRight -Right SeNetworkLogonRight | Format-List -Property SID |Set-Variable -Name "Accounts"
$Accounts
Output:
SID : S-1-5-32-583
SID : S-1-5-32-551
SID : S-1-5-32-545
SID : S-1-5-32-544
I am unsure of how to use formatting/other properties to cut out the 'SID' string, and just return an output such as "S-1-5-32-583,S-1-5-32-551,etc". I need to do this as I wish to use the output in another cmdlet, and the extra data is causing errors.