hdavid Posted August 2, 2005 Share Posted August 2, 2005 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, objComputerSet 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 ifnextThanks in advcance for your support.David Link to comment Share on other sites More sharing options...
Martin Zugec Posted August 2, 2005 Share Posted August 2, 2005 There is easier way - create template in GP, that will replace local administrators with your own selection... Link to comment Share on other sites More sharing options...
hdavid Posted August 2, 2005 Author Share Posted August 2, 2005 Well I know what you mean. but I need a listing who has actually the admin right and who hasn't ..any other help ? Link to comment Share on other sites More sharing options...
Martin Zugec Posted August 2, 2005 Share Posted August 2, 2005 Simple batch like this?Net LocalGroup Administrators > \\server\%computername%.log Link to comment Share on other sites More sharing options...
hdavid Posted August 2, 2005 Author Share Posted August 2, 2005 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 More sharing options...
Martin Zugec Posted August 2, 2005 Share Posted August 2, 2005 Try this:For /f "usebackq" %%i IN (`net localgroup administrators`) DO If %%i EQU %UserDomain%\%UserName% echo. > \\server\%computername%.log Link to comment Share on other sites More sharing options...
hdavid Posted August 2, 2005 Author Share Posted August 2, 2005 thanks for your reply.but do you know how you could do the same in VBS ?thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now