Rich22
asked on
Display report of local users and groups
Hello,
First of all, I have no knowledge in scripting. Does anyone have a script that will scan 200-400 PCs (NT-2K-XP machines) in a Windows NT 4.0 domain and will display a report that will list local users and groups for each PC. I'm particular interested in finding out on each PC who are members of the Administrator group or Power Users group. But a script that wil list all groups will be much better. Again we are running a Windows NT 4.0 Domain Controller.
I would appreciate it if anyone out there has a script. Since I'm new at this, can you also please tell me what program to use to run the script.
Thanks!
Rich
First of all, I have no knowledge in scripting. Does anyone have a script that will scan 200-400 PCs (NT-2K-XP machines) in a Windows NT 4.0 domain and will display a report that will list local users and groups for each PC. I'm particular interested in finding out on each PC who are members of the Administrator group or Power Users group. But a script that wil list all groups will be much better. Again we are running a Windows NT 4.0 Domain Controller.
I would appreciate it if anyone out there has a script. Since I'm new at this, can you also please tell me what program to use to run the script.
Thanks!
Rich
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The script does'nt work on W98 and NT with default installation:
You have to install Active Directory Client Extensions on your NT boxes:
http://www.microsoft.com/windows2000/server/evaluation/news/bulletins/adextension.asp
You have to install Active Directory Client Extensions on your NT boxes:
http://www.microsoft.com/windows2000/server/evaluation/news/bulletins/adextension.asp
Maybe you should place the script on your homedrive on your server
If so modify this line:
sFileName="C:\TEMP\" & sProgramNavn & ".txt"
If so modify this line:
sFileName="C:\TEMP\" & sProgramNavn & ".txt"
:o) Glad I could help you - thank you for the points
ASKER
Thanks for all your help. I appreciate it.
ASKER
One other thing, Can Edit script to just scan Administrator and Power users group only?
Thanks
Thanks
Yes - the thing is, that you set a placeholder (variable) for each group you want
In the above script I set:
sLocalAdminGroup = "Administrators"
sLocalAdminGroup = uCase(sLocalAdminGroup)
But I could also just have set:
sLocalAdminGroup = "ADMINISTRATORS"
The second line does the uppercase, I you by accident wrote "administrators", and the rest of the script would not work.
So make a new variable
sLocalPowerUsersGroup = "POWER USERS"
Just below sLocalAdminGroup
Next thing is to catch both groups when enumerating the actual groups
Above I did it:
For Each oGroup In colGroups
If uCase(oGroup.Name) = sLocalAdminGroup Then
For Each oUser in oGroup.Members
sFound = sDomainName & "/" & sComputer & sTab & oGroup.Name & sTab & oUser.Name
oFile.WriteLine sFound
Next
End if
Next
Change it to:
If uCase(oGroup.Name) = sLocalAdminGroup OR uCase(oGroup.Name) = sLocalPowerUsersGroup Then
In the above script I set:
sLocalAdminGroup = "Administrators"
sLocalAdminGroup = uCase(sLocalAdminGroup)
But I could also just have set:
sLocalAdminGroup = "ADMINISTRATORS"
The second line does the uppercase, I you by accident wrote "administrators", and the rest of the script would not work.
So make a new variable
sLocalPowerUsersGroup = "POWER USERS"
Just below sLocalAdminGroup
Next thing is to catch both groups when enumerating the actual groups
Above I did it:
For Each oGroup In colGroups
If uCase(oGroup.Name) = sLocalAdminGroup Then
For Each oUser in oGroup.Members
sFound = sDomainName & "/" & sComputer & sTab & oGroup.Name & sTab & oUser.Name
oFile.WriteLine sFound
Next
End if
Next
Change it to:
If uCase(oGroup.Name) = sLocalAdminGroup OR uCase(oGroup.Name) = sLocalPowerUsersGroup Then
>"First of all, I have no knowledge in scripting"
:o) Now you have some ....
Maybe you want more...
The Windows Scripting Guide
http://www.winguides.com/scripting/
:o) Now you have some ....
Maybe you want more...
The Windows Scripting Guide
http://www.winguides.com/scripting/
ASKER
Thanks again! I am planning on learning scripting.
>"But a script that wil list all groups will be much better"
For Each oGroup In colGroups
For Each oUser in oGroup.Members
sFound = sDomainName & "/" & sComputer & sTab & oGroup.Name & sTab & oUser.Name
oFile.WriteLine sFound
Next
Next
For Each oGroup In colGroups
For Each oUser in oGroup.Members
sFound = sDomainName & "/" & sComputer & sTab & oGroup.Name & sTab & oUser.Name
oFile.WriteLine sFound
Next
Next
If uCase(oGroup.Name) = sLocalAdminGroup Then
End if