Script to detect group membership

J

Josh

All:

I have found the following script on the internet that
supposedly detects group membership. How can I use it to
call a DOS batch file or execute regular DOS copy
commands? Thanks.

Private Function IsMember(groupName)

Set netObj = CreateObject("WScript.Network")
domain = netObj.UserDomain
user = netObj.UserName
flgIsMember = false
Set userObj = GetObject("WinNT://" & domain & "/" &
user & ",user")
For Each grp In userObj.Groups
If grp.Name = groupName Then
flgIsMember = true
Exit For
End If
Next
IsMember = flgIsMember
Set userObj = nothing
Set netObj = nothing

End Function
 
C

Chriss3 [MVP]

Josh,

You can use

If IsMember = "True" Then
Run "xcopy"
end if

--
Regards
Christoffer Andersson
Microsoft MVP - Directory Services

No email replies please - reply in the newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top