Solved

VBScript to uninstall app with command line switch

Posted on 2011-09-07
3
714 Views
Last Modified: 2012-05-12
I am trying to build a GPO which will run a vbscript at login on users Windows XP machines with Client Side Extensions installed.

In the script, I seach to see if the uninstall.exe is there and if so, then I try and run the following:

WshShell.Run ("%comspec% /c c:\progra~1\spark\uninstall.exe -q")

I try and run with %comspec% so I can use command line switches.  The vbscript, when run outside of the login script seems to work but if I try and run it via a login script, users get the following and the app will not run:

"CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory"

I am not stuck on using comspec but I am really looking for a way to utilize the login script to run the uninstall.exe with the -q command line option.

Any assistance is appreciated.
0
Comment
Question by:TexasPlowBoy
3 Comments
 
LVL 3

Expert Comment

by:Crower
ID: 36497276
you can create a bat in the path where the CMD starts. within the batch file you run all the statements you need. such as changing unit, launch an exe, etc. ..
0
 
LVL 13

Expert Comment

by:khairil
ID: 36497870
Hi,

Why not just write it this way?

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("cmd.exe /c c:\progra~1\spark\uninstall.exe -q")

Open in new window


I don't think you need to run full c:\windows\system\cmd.exe /c... for your command.

Comspec will always called CMD.EXE in Windows 2000 above, and access to CMD.EXE basically already declare on PATH variables.

0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 36499936
The fact that it defaults to the windows directory shouldn't matter either.  It should still run the uninstall command.

I think to avoid that, you can change the current directory of the script before running the command.

Regards,

Rob.
Set objShell = CreateObject("WScript.Shell")
objShell.CurrentDirectory objShell.ExpandEnvironmentStrings("%WINDIR%") & "\System32"
intReturn = objShell.Run("%comspec% /c c:\progra~1\spark\uninstall.exe -q", 1, True)

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question