bsharath
asked on
Uninstall Winrar remotely Via a script on a set of computer names in a txt file.
Hi,
Uninstall Winrar remotely Via a script on a set of computer names in a txt file.
I want help with a script that can uninstall Winrar on all machines in a txt file.
Regards
Sharath
Uninstall Winrar remotely Via a script on a set of computer names in a txt file.
I want help with a script that can uninstall Winrar on all machines in a txt file.
Regards
Sharath
ASKER
Thanks but my main need is the batch file....
Oh i have a link that will give you information about uninstalling using command line probably that might help you
http://www.pcterritory.net/2009/04/uninstall-and-delete-program-with.html
~Vikas
http://www.pcterritory.net/2009/04/uninstall-and-delete-program-with.html
~Vikas
Use pstools as vikas_madhusudana mentioned, and I write the script to unintall winrar.
You may run it like: psexec.exe @machines.txt -u username -p password -w c:\ -d -c uninstall_winrar.js
You may run it like: psexec.exe @machines.txt -u username -p password -w c:\ -d -c uninstall_winrar.js
var WshShell = WScript.CreateObject ("WScript.Shell");
var uninstallString = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\WinRAR archiver\\UninstallString");
WshShell.Run( '"'+uninstallString+'" /s', 0, true )
ASKER
I get this
-------------------------- -
Windows Script Host
-------------------------- -
Script: C:\uninstall_winrar.js
Line: 3
Char: 1
Error: Invalid root in registry key "HKLM\Software\Microsoft\W indows\Cur rentVersio n\Uninstal l\WinRAR archiver\UninstallString".
Code: 80070002
Source: WshShell.RegRead
-------------------------- -
OK
-------------------------- -
If the machine does not have the sting then move to next computer.
I am running from the Domain admin so will not be using the username and password
--------------------------
Windows Script Host
--------------------------
Script: C:\uninstall_winrar.js
Line: 3
Char: 1
Error: Invalid root in registry key "HKLM\Software\Microsoft\W
Code: 80070002
Source: WshShell.RegRead
--------------------------
OK
--------------------------
If the machine does not have the sting then move to next computer.
I am running from the Domain admin so will not be using the username and password
@bsharath: the msg means that computer does'nt install winrar, just ignore it.
Or if the winrar is not installed by installer, that will be a little complicated, you can try with this:
Or if the winrar is not installed by installer, that will be a little complicated, you can try with this:
var WshShell = WScript.CreateObject ("WScript.Shell");
var uninstallString = "";
try {
uninstallString = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\WinRAR archiver\\UninstallString");
} catch (e) {
uninstallString = WshShell.RegRead("HKCR\\.rar\\ShellNew\\FileName");
uninstallString = uninstallString.substr(0, uninstallString.lastIndexOf("\\")) + "\\Uninstall.exe";
}
WshShell.Run( '"'+uninstallString+'" /s', 0, true );
ASKER
I get this
PsExec could not start uninstall_winrar.js on de163:
The system cannot find the file specified.
PsExec could not start uninstall_winrar.js on de163:
The system cannot find the file specified.
The -c argument of PsExec will copy uninstall_winrar.js to the remote system.
Does only computer "de163" throw this message?
What about other computers?
Does only computer "de163" throw this message?
What about other computers?
ASKER
Ok i tried many more for all i get the same. I tried running on 1 machine directly and i get this
-------------------------- -
Windows Script Host
-------------------------- -
Script: C:\uninstall_winrar.js
Line: 7
Char: 5
Error: Invalid root in registry key "HKCR\.rar\ShellNew\FileNa me".
Code: 80070002
Source: WshShell.RegRead
-------------------------- -
OK
-------------------------- -
--------------------------
Windows Script Host
--------------------------
Script: C:\uninstall_winrar.js
Line: 7
Char: 5
Error: Invalid root in registry key "HKCR\.rar\ShellNew\FileNa
Code: 80070002
Source: WshShell.RegRead
--------------------------
OK
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi
The script works fine but it does not work when deplyed via psexec or for loop code \or any other
Is there any known reasone. Does the js extension code work via the startup script. if i use this code in the startup script in AD will it run and unistall winrar
How can i not get any boxes when done
The script works fine but it does not work when deplyed via psexec or for loop code \or any other
Is there any known reasone. Does the js extension code work via the startup script. if i use this code in the startup script in AD will it run and unistall winrar
How can i not get any boxes when done
jscript could work via start script: cscript.exe xxx.js
ASKER
Ok thanks please take care
ASKER
Sorry aove is on the wrong post...Shall check and get back
ASKER
Thank U
you can use pstools to do so downloadlink(http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx)
psexec.exe @machines.txt -u username -p password -w c:\ -d -c batch_file.bat
*machines.txt has all the machine names or ip's of machines.
*username - domain adminuser so that he has permission on all machines
*password- password of adminuser
*-w is a used to set the current working directory(i.e where the batch file to be executed is placed the target machine)
*batch_file.bat is the batch file that needs to be run( here batch file to uninstall winrar)
~vikas