Help with Script please - Local Users and groups
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Help with Script please - Local Users and groups

 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming
Author Message
Luke Ross
Guest





Posted: Tue Jan 04, 2005 5:23 am    Post subject: Help with Script please - Local Users and groups Reply with quote

I am running the following script located in MS Script samples below
http://www.microsoft.com/technet/scriptcenter/scripts/ds/local/groups/logpvb05.mspx

I would like the strComputer to equal the current machine it is being ran
on.. When using a system variable like %COMPUTERNAME%, the script fails.

I am new to scripting and was wondering if there was a way to modify the
script to run on the current machine. And not just by specifying it manually.

-----------------------------------------
strComputer = "%COMPUTERNAME%"
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")

For Each objGroup In colGroups
Wscript.Echo objGroup.Name
For Each objUser in objGroup.Members
Wscript.Echo vbTab & objUser.Name
Next
Next
-----------------------------------------



Thanks,
Luke Ross
Washington County, OR
Back to top
Michael Harris (MVP)
Guest





Posted: Tue Jan 04, 2005 7:01 am    Post subject: Re: Help with Script please - Local Users and groups Reply with quote

Luke Ross wrote:
Quote:
I am running the following script located in MS Script samples below:
http://www.microsoft.com/technet/scriptcenter/scripts/ds/local/groups/logpvb05.mspx

I would like the strComputer to equal the current machine it is being
ran on.. When using a system variable like %COMPUTERNAME%, the script
fails.

I am new to scripting and was wondering if there was a way to modify
the script to run on the current machine. And not just by specifying
it manually.



strComputer = "."
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")

For Each objGroup In colGroups
Wscript.Echo objGroup.Name
For Each objUser in objGroup.Members
Wscript.Echo vbTab & objUser.Name
Next
Next



Quote:

-----------------------------------------
strComputer = "%COMPUTERNAME%"
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")

For Each objGroup In colGroups
Wscript.Echo objGroup.Name
For Each objUser in objGroup.Members
Wscript.Echo vbTab & objUser.Name
Next
Next
-----------------------------------------



Thanks,
Luke Ross
Washington County, OR

--
Michael Harris
Microsoft MVP Scripting
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB