I want to run a script that will search all the computers on my network for common spyware, chat programs, and other baddies that we don't want our users to have. I am looking to make a psexec script that will search for directories on their computers and look for a positive match.
For example:
psexec @c:\computers.txt cmd /c dir "c:\program files"\MyWebSearch
Would return with error code 0 if that directory existed. Otherwise it would return with error code 1.
Note: the argument c:\computers.txt is a list of all the computers on my domain that I want to check.
So if I make up a batch file like so:
this would give me output like so for each of the commands for each of the computers:
--Positive Match
Now the question is, how can I run multiple commands on each computer in a row. That way I can see what computer I'm running it on with something like an ipconfig command. Then I can search for each directory on that computer. Then move on to the next computer.
Any ideas are welcome
thanks.
For example:
psexec @c:\computers.txt cmd /c dir "c:\program files"\MyWebSearch
Would return with error code 0 if that directory existed. Otherwise it would return with error code 1.
Note: the argument c:\computers.txt is a list of all the computers on my domain that I want to check.
So if I make up a batch file like so:
Code:
psexec @c:\computers.txt cmd /c dir "c:\program files"\MyWebSearch
psexec @c:\computers.txt cmd /c dir "c:\program files"\AOL*
psexec @c:\computers.txt cmd /c dir "c:\program files"\AIM*
psexec @c:\computers.txt cmd /c dir "c:\program files"\yahoo*
psexec @c:\computers.txt cmd /c dir "c:\program files"\trill*
this would give me output like so for each of the commands for each of the computers:
--Positive Match
--Negative MatchVolume in drive C has no label.
Volume Serial Number is CCD0-6CA7
Directory of c:\program files\MyWebSearch
04/06/2007 09:50a <DIR> .
04/06/2007 09:50a <DIR> ..
05/14/2007 10:48a <DIR> bar
04/06/2007 09:50a <DIR> SrchAstt
0 File(s) 0 bytes
4 Dir(s) 75,186,749,440 bytes free
Volume in drive C has no label.
Volume Serial Number is 9839-31AC
Volume in drive C has no label.
Volume Serial Number is 9839-31AC
Directory of c:\program files
Now the question is, how can I run multiple commands on each computer in a row. That way I can see what computer I'm running it on with something like an ipconfig command. Then I can search for each directory on that computer. Then move on to the next computer.
Any ideas are welcome
thanks.