Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

ForEach export assistance

$
0
0

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)"




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>