Any help with this would be GREATLY appreciated, our scripting person is out and i need to get all the local users off a list of computers. however the script we have doesn't export it to CSV. I've tried adding the Export function but i don't get a return, as this is not something that is part of my normal/or abnormal duties i'm at a loss. Please see script below:
$Computers = ("")ForEach ($Computer in $Computers) {
$strComputer = [ADSI]"WinNT://$Computer"
$Groups = $strComputer.psbase.Children | Where {$_.psbase.schemaClassName -eq "group"}
"`n`n============================"
"Computer: " + $Computer
"============================"
ForEach ($Group In $Groups)
{
"Group: " + $Group.Name
$Members = @($Group.psbase.Invoke("Members"))
ForEach ($Member In $Members)
{
$Class = $Member.GetType().InvokeMember("Class", 'GetProperty', $Null, $Member, $Null)
$Name = $Member.GetType().InvokeMember("Name", 'GetProperty', $Null, $Member, $Null)
"-- Member: $Name ($Class)"
}
}
}