Link to home
Create AccountLog in
Avatar of bsharath
bsharathFlag for India

asked on

Search all machines C drive

Hi,

I want a script which can search the C drives of all machines in a txt file.For the extensions *.PST.If there are any files with *.Pst i want it to be listed in the results file.

regards
Sharath
ASKER CERTIFIED SOLUTION
Avatar of Fridolin Mansmann
Fridolin Mansmann
Flag of Switzerland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer

:: Script Start
@Echo Off
@Echo. >C:FileResult.txt
FOR /F %%c IN (Computers.txt) DO (
      @Echo Checking system %%c
      @Echo ----------------- >>C:FileResult.txt
      @Echo %%c : .PST Files      >>C:FileResult.txt
      @Echo ----------------- >>C:FileResult.txt
      Dir /b \\%%c\C$\*.PST      >>C:FileResult.txt
      @Echo.                  >>C:FileResult.txt
)
:: Script End
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.