Remote batch file?

srbarcena

Limp Gawd
Joined
Feb 1, 2008
Messages
138
I have this batch file that lists the installed programs on a pc. is there any way to have it run on all computers in a domain remotely and possibly put the results into a seperate text file for each system? Any help is welcome. thanks.

Code:
@echo off

If Exist c:\installedprogs.txt Del c:\installedprogs.txt

regedit /e c:\regexport.txt "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall"

find "DisplayName" c:\regexport.txt >c:\regprogs.txt

for /f "tokens=2 delims==" %%a in (c:\regprogs.txt) do echo %%~a >>c:\installedprogs.txt

del c:\regexport.txt
del c:\regprogs.txt

exit
 
Yea, run it as a login script and have it copy the .txt file to a network share...just name the test file based off the computer name or something.
 
is there any other way to do that? i cant really mess with logon scripts. i wanna really just sit at my desk and double click it and watch it go
 
is there any other way to do that? i cant really mess with logon scripts. i wanna really just sit at my desk and double click it and watch it go

Sounds like someone dosent run/own this domian. and have admin rights :eek:
 
Using one batch file, copy it into a common location on every machine. Then, use PSEXEC to execute the command from the common location on each box. From there, use another batch file to gather your results. Use the FOR command for each of the 3 processes.

That's what I'd do if I didn't have Config Manager (formerly SMS).
 
...or, alternately, you can use the AT command and schedule a task to execute it on each PC, if you don't feel like/don't want to use PSEXEC.

OR... you could use the REG QUERY command against the UNC path of every PC...

Put your machines in a list called list.txt

Then do something like (sorry, not at work so I can't easily test this - but I'm sure you'll figure it out):
FOR /F %A in (list.txt) do REG QUERY "\\%A\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" >C:\Results\%A_Results.txt​
 
I would use PSexec.exe to push it to all the computers and start the process.

Set it and walk away
 
...or, alternately, you can use the AT command and schedule a task to execute it on each PC, if you don't feel like/don't want to use PSEXEC.

OR... you could use the REG QUERY command against the UNC path of every PC...

Put your machines in a list called list.txt

Then do something like (sorry, not at work so I can't easily test this - but I'm sure you'll figure it out):
FOR /F %A in (list.txt) do REG QUERY "\\%A\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" >C:\Results\%A_Results.txt​

Would i just use that one line as a batch or would i incorporate this into my existing script? (ok its not mine i googled and found it lol, but hey it works)

Probably a change review board

Exactly. Its too much of a hassle if i can just do it the easy way
 
This line?

FOR /F %A in (list.txt) do REG QUERY "\\%A\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Uninstall" >C:\Results\%A_Results.txt​

You'd execute it from the command line. No batch necessary.

Make sure you've CD'd to the directory with the list.txt file. Also, make sure you have a Results directory on your C:\ drive. It should work... assuming you have the remote registry service enabled on all of your machines, and the firewall off.
 
i got it to work. of course the uninstall entry for the program we want to uninstall isnt written out in text, and now i have to figure out what they are
 
Check HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall ...

This is populated by the GUID values of the apps that are installed.

If the app was installed with MSIEXEC, and assuming the same version of the app is installed globally, the uninstall should, in theory, be easy.

Something like this will uninstall an app silently:
MsiExec.exe /X {4D37A396-7E00-11D6-99DD-00600815E2D0} /QN

Of course, you'd definitely need to use PSEXEC to do it on all the remote machines.
 
i have to find what it translates to because its the crap in the brackets and it doesnt say firefox or whatever. and it probably isnt the same version all the way around. we have several versions of images going around unfortunately
 
Back
Top