Using a .bat to run dir on multiple locations on the network

Hey

I’m a trainee ICT technician, but haven’t a huge amount of knowledge when it comes to scripting. The most I’ve really used cmd and MS-DOS for is running old games back in the days of apogee. sigh ah the memories…

Anyways One of my tasks at my job is to keep an eye on the users to make sure that they aren’t into stuff they shouldn’t be. This also includes making sure that they aren’t using company laptops to store pirated media.

I’m trying to write a batch file that can run the dir command on the network at work to display a list of all the files in a number of different locations. 'tisn’t working for me. This is what I’m trying to run:

runas /user:domain\username “dir \computername\c$”

It then prompts me for a password, then gives the following error:
2: The system cannot find the file specified.

Anyone got any ideas?

Ahhh the memories indeed, I miss those days as well.

Couldn’t you limit torrent traffic or monitor network activity, rather than trying to find stuff AFTER it’s downloaded? Just a thought.

As for the command you’re trying, I just ran it on our network at work and it ran fine…are you running it against fat clients? Are you copying the .bat file to each machine, or are you running the script on your machine and just passing in parameters?

Might want to check here - https://forums.vandyke.com/archive/index.php/t-959.html

Unfortunately I’m just the trainee and don’t have access to any of the core network stuff, so I can’t log on to the server to monitor traffic. I know there must be better ways to handle and track all of this stuff (We’ll be getting handy spying software soon) but I’m still learning, and slowly but surely I’ll learn better ways of doing these things.

Your link has been helpful, it explains why I can’t run dir remotely. I’ll have a look into ssh later :slight_smile:

I’ve learnt that I can mount remote directories using the “net use” command, and then run a dir on the mounted directory. Crude, and I still have a lot of work on the script to do, but it gets the job done.

net use /user:domain\user x: \computername\c$
dir x:

Thanks heaps for your help! I welcome any more suggestions, I can’t promise though that I’ll have time to try them all out though as I’ve got to balance all my normal jobs with my tinkering.

in all honesty, ur using the wrong tool for the job, as using simple DOS commands ain’t flexible nor powerfull, and u will run into problems regarding UNC paths

I recommend you writing a VBScript to handle the task, since it can be extremely flexible on what actions u can take after you find the files, and since it uses Windows API for most things, i doubt it will have a problem using UNC paths

heres an example: https://www.tek-tips.com/faqs.cfm?fid=5515

Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.