Cheers Marco, but in my server environment the windows firewalls are not enabled.
Anyway, I had to quickly todo it vb I needed the results quick,
I have now done a vbscript which using the GetObject("WinNT")..
I have looked around to find a powershell script the to the below but can't find any solutions:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'Author: James Brown
'Description: List local groups and there members
'version: 1.0
' Variables
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim strComputer, OutFile, Outfilestr
' Const
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
const ForReading = 1, ForWriting = 2, ForAppending = 8
'Arguments
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set objArgs = WScript.Arguments
if WScript.Arguments.Count < 2 then
wscript.echo " Not Enough Parameters "
wscript.echo " Usage:-- Sourcefile"
wscript.echo " i.e: c:\script.vbs c:\listusers.txt c:\output"
wscript.quit (1)
end if
sourcefile=wscript.Arguments(0)
destpath=wscript.Arguments(1)
'File to Read From
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set fso = CreateObject("Scripting.FileSystemObject")
set infile = fso.OpenTextFile( sourcefile, 1 , True)
'Main Part
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Call Main
Sub Main
do until infile.AtEndOfStream
ReadLineTextFile = infile.ReadLine
On Error Resume Next
strComputer = ReadLineTextFile
Outfilestr = destpath &"\" &strComputer &".csv"
Set fso2 = CreateObject("Scripting.FileSystemObject")
Set OutFile = fso2.CreateTextFile(Outfilestr)
Wscript.echo "Server: " &strComputer &vbCrlf &vbCrlf
OutFile.writeline strComputer
OutFile.writeline ""
OutFile.writeline "Group,Users"
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
For Each objGroup In colGroups
GroupName = objGroup.Name
Wscript.Echo "Group: " &GroupName
Wscript.Echo "---------------------------------------------------------"
For Each objUser in objGroup.Members
UserName = objUser.Name
Wscript.Echo vbTab &UserName
OutFile.writeline GroupName &"," &UserName
Next
Wscript.Echo ""
Next
Loop
End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I have found the following which lists the local groups, but not there members...
http://www.myitforum.com/articles/4...p?id=10693 $strComputer = "."
$computer = [ADSI]("WinNT://" + $strComputer + ",computer")
$group = $computer.psbase.children |where{$_.psbase.schemaclassname -eq "group"}
foreach ($member in $group.psbase.syncroot)
{$member.name}
Is there a way of modifying the above PS script to get the members ?
Cheers
James