Jump to content

I need help in VBS.. please..


Recommended Posts


I'm a domain admin and we are currently facing the issue about the local admin right. I need to have a script that run on every machine to know who as effectively admin right locally. As output I would like to have a text file "compname.txt" and in it the user id who as the admin right...

I've the following script at the moment who is unfortunately not working

dim objLocalGroup, objUser, objComputer

Set objLocalGroup = GetObject("WinNT://" & gComputerName & "/Administrators,group")

for each objUser in objLocalGroup.Members

  if gUserName = objUser.Name then

    dim chk

    set chk = gObjFSO.OpenTextFile("IsAdmin.txt", 2, True)

    chk.WriteLine now & vbTab & objUser.Name


  end if


Thanks in advcance for your support.


Link to comment
Share on other sites

thanks for your reply.

I know this command. but this will generate for every computer a log file which is not what I need..

I need to check first is their is user in the local admin group and if yes generate log file..

any other help ?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...