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



As a last resort you can double click on the file RDPMembers.vbs in Windows
Explorer. This will run the program with the default host program on your
computer, most likely wscript.exe. The program will run, but you will get a
message box for each computer and each member of the group on the computer.
You will need to click to acknowledge each message box. However, once you
find the file in Windows Explorer, this should help you navigate in the
command prompt window to the folder where it is saved.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx> wrote in
message news:OsGJ3NI8JHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
You are not in the directory (folder) where the file RDPMembers.vbs is
saved. Your text file of computer names must be located in a folder on
your computer. It would be best to save the file RDPMembers.vbs
(containing the VBScript program I posted earlier) in the same folder.
When you get to a command prompt you must navigate to this folder. If the
folder is c:\Scripts, the command in the command console window would be:

cd c:\Scripts

The "cd" command means change directory. After this the prompt in the
window will probably be:

c:\Scripts

indicating you are in the Scripts folder on drive c:. If your folder or
path includes any spaces, enclose the folder in quotes. For example, if
RDPMembers.vbs is saved in "c:\My Folder", the command at a command prompt
would be:

cd: "c:\My Folder"

You can check if the file RDPMembers.vbs is in the folder with the "dir"
command:

dir RDPMembers.vbs

The command processor will indicate the file name, size, and date. Or, if
the file is not found, will display "File not found".

Most administrative scripts are run at a command prompt this way. The
alternative is to add a great deal more code to the program so it writes
output to a text file, but then you still need to find that output file. I
hope this helps.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"dave" <dave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BA402293-324D-4AB4-9246-AC3B5D41F214@xxxxxxxxxxxxxxxx
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:

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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CD288B38-E092-48C8-B490-5266F17C51EC@xxxxxxxxxxxxxxxx
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:


"dave" <dave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:767DA0FC-D26E-42DB-AC07-778EF8AEACEA@xxxxxxxxxxxxxxxx
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
--










.



Relevant Pages

  • Re: Zip Files are Blocked
    ... > tool Streams.exe to purge any streams from the files after they are ... when you want to clean out all the streams in files in a folder ... > Then open an Explorer window (place the window so it doesn't cover the ... > command prompt completely) and in Explorer locate the folder you want ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Open file on fileserver (using file:\ or \fileserverdirecto
    ... In your case it refers to a folder name, ... When I open the Run window and paste the same line an Explorer ... What exactly do you see when you open a Command Prompt and type this: ...
    (microsoft.public.windowsxp.general)
  • Re: Error Message -Item Not Found-
    ... If "Switch Sound File Converter.lnk" is the name of your shortcut, then you will need to enclose the ENTIRE pathname in quotes to deal with it because it includes space characters - and the quotes must enclose the drive letter, too: ... That should leave you at the Command Prompt and in that folder; ... In a Command Prompt window, we can use these SFNs, even when we are not sure ...
    (microsoft.public.windows.vista.file_management)
  • Re: Finding members of RDP groups of a list of computers
    ... got the script to work by double clicking the vbs file. ... cscript //nologo RDPMembers.vbs> report.txt from the command prompt? ... MVP Directory Services ... Your text file of computer names must be located in a folder on ...
    (microsoft.public.scripting.vbscript)
  • Re: Error Message -Item Not Found-
    ... That should leave you at the Command Prompt and in that folder; ... In a Command Prompt window, we can use these SFNs, even when we are not sure ... some are system files that Vista won't let us do ...
    (microsoft.public.windows.vista.file_management)