View Single Post
Old 06-17-2009   #3 (permalink)
dave


 
 

Re: Finding members of RDP groups of a list of computers

Hi Richard,

Thanks for the quick response. I do not know much about scripting so if you
could guide me through this it would be great

i assume i save this script as .vbs?
put a txt file called computers in the same folder when running?
how do i run at a command prompt using cscript?



"Richard Mueller [MVP]" wrote:
Quote:

>
> "dave" <dave@xxxxxx> wrote in message
> news:767DA0FC-D26E-42DB-AC07-778EF8AEACEA@xxxxxx
Quote:

> > Title pretty much says it all
> >
> > I'm trying to find a script which will find the members of the rdp group
> > from a list of PC's on a domain from a txt file
> >
> > Can anyone help?
>
> I assume you mean the local "Remote Desktop Users" group on each computer.
> You can use the FileSystemObject to read the text file of computer names,
> then bind to the local group on each computer using the WinNT provider. You
> can use the Members method of the group object to enumerate the direct
> members and echo their names to the console. For example:
> ==========
> Option Explicit
>
> Dim objFSO, strFile, objFile
> Dim strComputer, objGroup, objMember
>
> Const ForReading = 1
>
> strFile = "c:\Scripts\computers.txt"
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFile = objFSO.OpenTextFile(strFile, ForReading)
>
> Do Until objFile.AtEndOfStream
> strComputer = Trim(objFile.ReadLine)
> If (strComputer <> "") Then
> Wscript.Echo "Computer: " & strComputer
> Set objGroup = GetObject("WinNT://" & strComputer _
> & "/Remote Desktop Users,group")
> For Each objMember In objGroup.Members
> Wscript.Echo objMember.Name
> Next
> End If
> Loop
>
> objFile.Close
> =======
> This should be run at a command prompt using cscript. You can redirect the
> output to a text file.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
My System SpecsSystem Spec