dim dom,un,ls,user
Set WshShell = WScript.CreateObject("WScript.Shell"
Set WshEnvironment = WshShell.Environment("Process"
dom = WshEnvironment.item("USERDOMAIN"
un = WshEnvironment.item("USERNAME"
ls = right(WshEnvironment.item("LOGONSERVER",len(WshEnvironment.item("LOGONSERVER") -2)
Set user = GetObject("WinNT://" & dom & "/" & ls & "/" & un)
WScript.Echo "Login Script: " & User.LoginScript
WScript.Echo "Profile: " & User.Profile
WScript.Echo "PasswordExpirationDate: " & User.PasswordExpirationDate
WScript.Echo "HomeDirectory: " & User.HomeDirectory
WScript.Echo "Groups: "
for each Group in User.Groups
WScript.Echo vbtab & Group.name
next
WScript.Echo "LastFailedLogin: " & User.LastFailedLogin
I wrote the code above to check the groupmembership for a user on a particular domain.
I want to check the groupmembership of 300 users.
I have an excel spreadsheep which contain the list of users and the domain they are member.
I am new to wsh scripting. How to I have the script read from the excel file the user id the domain and write the group the user belongs to ?
Set WshShell = WScript.CreateObject("WScript.Shell"
Set WshEnvironment = WshShell.Environment("Process"
dom = WshEnvironment.item("USERDOMAIN"
un = WshEnvironment.item("USERNAME"
ls = right(WshEnvironment.item("LOGONSERVER",len(WshEnvironment.item("LOGONSERVER") -2)
Set user = GetObject("WinNT://" & dom & "/" & ls & "/" & un)
WScript.Echo "Login Script: " & User.LoginScript
WScript.Echo "Profile: " & User.Profile
WScript.Echo "PasswordExpirationDate: " & User.PasswordExpirationDate
WScript.Echo "HomeDirectory: " & User.HomeDirectory
WScript.Echo "Groups: "
for each Group in User.Groups
WScript.Echo vbtab & Group.name
next
WScript.Echo "LastFailedLogin: " & User.LastFailedLogin
I wrote the code above to check the groupmembership for a user on a particular domain.
I want to check the groupmembership of 300 users.
I have an excel spreadsheep which contain the list of users and the domain they are member.
I am new to wsh scripting. How to I have the script read from the excel file the user id the domain and write the group the user belongs to ?