set objShell = createobject("wscript.shell")
set objNetwork = createobject("Wscript.network")
ComputerName = objNetwork.computername
set objNetwork = Nothing
set objShell = Nothing
strOutputFile = replace(wscript.scriptfullname,wscript.scriptname,"")&"Logs.txt"
strComputer = "."
'create output file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(strOutputFile)
objTextFile.writeline "##########################################################"&vbcrlf
objTextFile.writeline "COMPUTER NAME :"& ComputerName&vbcrlf&"Local Group Details "&vbcrlf
objTextFile.writeline "##########################################################"
objTextFile.writeline
'objTextFile.writeline "Group_Name" & vbtab& vbtab & "Configured Users"
Set colGroups = GetObject("WinNT://" & strComputer & "")
if err.number <> 0 then
wscript.echo "Connection Failed"&vbcrlf&err.description
wscript.quit
end if
colGroups.Filter = Array("group")
big=0
For Each objGroup In colGroups
objTextFile.WriteLine "*****************************************************"
objTextFile.WriteLine
Users_Flag = FALSE
do until i=17
tmp=tmp&" "
i=i+1
loop
User_Count=0
For Each objUser in objGroup.Members
GroupUsers = GroupUsers&vbcrlf&tmp&objUser.Name
User_Count = User_Count + 1
Users_Flag = TRUE
Next
GroupName = objGroup.Name
do until len(GroupName) = 65
GroupName=GroupName&" "
Loop
if Users_Flag = TRUE then
objTextFile.WriteLine "GROUP NAME :"& GroupName &vbcrlf&vbcrlf &_
"TOTAL USERS :" & User_Count & vbcrlf&vbcrlf &"USERS CONFIGURED:" & GroupUsers
else
objTextFile.WriteLine "GROUP NAME :"& GroupName &vbcrlf&vbcrlf &_
"TOTAL USERS :"& User_Count &vbcrlf&vbcrlf &"USERS CONFIGURED:" &"NONE"
end if
objTextFile.WriteLine
Next
objTextFile.WriteLine "*****************************************************"
objTextFile.Close
msgbox "done"
Monday, November 9, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment