Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Get all the file names of a remote machine to a file.

Hi,

I have a list of machine names .Can i have a script to scan the machine and get the file names to a txt file.

Ex:
C:\filename.txt
C:\filename.bmp
etc

Regards
Sharath
Avatar of Farhan Kazi
Farhan Kazi
Flag of Australia image

Can you please specify drive, path or file types you want to include in scan? or you want list of all files (it will be very difficult for you to read that output file).
Avatar of bsharath

ASKER

I Need to get for a specific drive
Any help
Hi Sharath,

I just posted a script here:
https://www.experts-exchange.com/questions/22712374/Need-a-script-to-search-all-the-machines-in-the-file-for-all-the-file-names-in-the-file.html

that could be changed to suit this question.  Is there a specific set of files that you want to get a list of, or you want to know ALL of the files for a speicific drive on a remote machine?

Regards,

Rob.
The posted one is to find and delete.But this is to search and get all the names to a file

Ex:
C:\filename.txt
C:\filename.bmp
etc
Every single file on a specific drive?
That's going to be a large text file.....and may just better using
dir /s > Files.txt
remotely........

Regards,

Rob.
Actually, come to think of it, I think that would be much faster.....I might change the other one as well....tomorrow though, it's late now.....

Rob.
Ok thanks
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This script when i run.It just asks me for the Drives.When i give a drive "D" without qotes it says done that's it.No other output.
Do you see the Notepad document coming up?  That should happen when it gets to this line:
objShell.Run "notepad " & strOutputFile, 1, False

Which launches Notepad (the same as clicking Start --> Run, type
notepad
and press Enter.

See if you can run
notepad "C:\Temp\Test.txt"
as long as that file exists, and if so, this should work.

Regards,

Rob.
As we discovered in the other question you were asking, the problem was that you needed to change the path pointing to PSExec, otherwise it could not run the remote process.

Thanks Sharath,

Regards,

Rob.
Change the path as this.

 I forgot to mention you will need to change this part
strCommand = "cmd /c \\mccdc01\netlogon\psexec_182.exe ........

which specifies the path to PSExec....Sorry!

If you have PSExec in the same path as the script file, just change the above to
strCommand = "cmd /c psexec.exe ........

And it worked....