Jump to content

I need help in VBS.. please..


hdavid

Recommended Posts

Hello,

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

    chk.Close

  end if

next

Thanks in advcance for your support.

David

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...