8 replies
by neal2002
by john
by sako
This WSH script enumerates what groups a user is a member of and prints it to a file named C:\Groups.txt. Edit it to fit into your current logon script and you are good to go. Hope this helps!
fso = new ActiveXObject("Scripting.FileSystemObject");
aFile = "C:\\Groups.txt"
ForWriting = 2
ForAppending = 8
domain = "Put your domain here"
username = "type Username here"
usr = GetObject ("WinNT://" + domain + "/" + username + ",user")
mList = new Enumerator(usr.Groups());
for (; !mList.atEnd();mList.moveNext())
{
s = mList.item()
//Write a log
if (fso.FileExists(aFile)){
f = fso.OpenTextFile(aFile, ForAppending)
f.Write(s.Name)
f.WriteBlankLines(1)
f.Close()
}
else{
f = fso.OpenTextFile(aFile, ForWriting, "True")
f.Write(s.Name)
f.WriteBlankLines(1)
f.Close()
}
}
by john
by john
by sako
by john
by john
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending