Output in CSV file
Good morning,
i have the following code:
$PdlList = Get-Content “C:TempComputers.txt”
Foreach($Pdl in $PdlList)
{
Invoke-Command -ComputerName $Pdl -ScriptBlock{Get-LocalGroupMember -Name ‘Administrators’ | where {($_.PrincipalSource -ne “ActiveDirectory” )} } | select PSComputerName, Name, PrincipalSource
}
| Export-Csv c:temptest.csv -Append -NoTypeInformation -Encoding UTF8
I can’t insert the result into a csv file, every time I run the script the file remains empty. Can someone help me?
Good morning,i have the following code: $PdlList = Get-Content “C:TempComputers.txt”
Foreach($Pdl in $PdlList)
{
Invoke-Command -ComputerName $Pdl -ScriptBlock{Get-LocalGroupMember -Name ‘Administrators’ | where {($_.PrincipalSource -ne “ActiveDirectory” )} } | select PSComputerName, Name, PrincipalSource
}
| Export-Csv c:temptest.csv -Append -NoTypeInformation -Encoding UTF8 I can’t insert the result into a csv file, every time I run the script the file remains empty. Can someone help me? Read More