"dave" <dave@xxxxxx> wrote in message
news:37264248-58EA-451B-A54F-509928CB0DAC@xxxxxx
Quote:
> Hi Richard,
>
> i've tried just double clicking the .vbs file, the command prompt comes up
> then disappears.
>
> any suggestions?
Your default host seems to be cscript.exe. I'd suggest you open a command
prompt window, PUSHD to the folder containing your .vbs file, then run the
script interactively. This way the error messages will remain on-screen long
enough to read them.
../Al
Quote:
> "Richard Mueller [MVP]" wrote:
> Quote:
>> 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@xxxxxx> wrote in
>> message news:OsGJ3NI8JHA.1252@xxxxxx Quote:
>> > 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@xxxxxx> wrote in message
>> > news:BA402293-324D-4AB4-9246-AC3B5D41F214@xxxxxx
>> >> 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@xxxxxx> wrote in message
>> >>> news:CD288B38-E092-48C8-B490-5266F17C51EC@xxxxxx
>> >>> > 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@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
>> >>> >> --
>> >>> >>
>> >>> >>
>> >>> >>
>> >>>
>> >>>
>> >>>
>> >
>> > >>
>>
>>