Learn when you want, where you want with convenient online training courses. Sign up now!
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
'create an instance of the Wscript Network object; using the (2) objects
Set objNetwork = CreateObject("Wscript.Network")
'set your strings
strComputer = objNetwork.ComputerName
strUser = objNetwork.UserName
'set variables for the write process
Dim Filesys, WriteFiletxt
Set Filesys = CreateObject("Scripting.FileSystemObject")
Set WriteFiletxt = Filesys.CreateTextFile("c:\local-admin.txt", false)
'use the WinNT provider to bind to the Administrators group on the computer in question
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
'set up For Each loop to walk through the group membership
For Each objUser in objGroup.Members
If objUser.Name = strUser Then
'Write output to the text file listed above
WriteFiletxt.WriteLine strUser & " Has Administrator Rights. "
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Administration of Active Directory does not have to be hard. Too often what should be a simple task is made more difficult than it needs to be.The solution? Hyena from SystemTools Software. With ease-of-use as well as powerful importing and bulk updating capabilities.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.