Hi Richard. Thanks for that. But i'm unable to get it to run. all i get is
the RDPMembers.vbs does not exists message. I know i'm doing something
wrong. but don't know what.
"Richard Mueller [MVP]" wrote:
Quote:
> You are correct. Save the program in a file with *.vbs extension, such as
> RDPMembers.vbs. Save the computer NetBIOS names, one name per line, in a
> text file, perhaps computers.txt. The path for this file is hard coded in
> the program, so you need to modify this line:
>
> strFile = "c:\Scripts\computers.txt"
>
> for your situation. I like to save VBScript programs in my own folder.
> Launch a command prompt. I use the "Run..." feature and enter cmd.exe. You
> can also create a shortcut to cmd.exe and place it on your desktop. In the
> command prompt, navigate to the folder where the file RDPMembers.vbs is
> saved. Then enter the command:
>
> cscript //nologo RDPMembers.vbs
>
> This tells the cscript.exe host program to run the program RDPMembers.vbs.
> The //nologo optional parameter means to not display logo information. If
> the file RDPMembers.vbs is not in the current directory, include the path.
> For example:
>
> cscript //nologo c:\scripts\RDPMembers.vbs
>
> The program as written displays the computer names and group member names in
> the console. You can redirect this output to another text file. For example:
>
> cscript //nologo RDPMembers.vbs > report.txt
>
> I hope this helps.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "dave" <dave@xxxxxx> wrote in message
> news:CD288B38-E092-48C8-B490-5266F17C51EC@xxxxxx Quote:
> > 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
> >> > 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
> >> --
> >>
> >>
> >> >
>
>