Skip to content

Deploying a .cmd script, not working

Featured Replies

I've deployed a .cmd file out that contains a WMI script to uninstall all instances of an application called "VirtViewer". The script looks like this:

taskkill /F /IM remote-viewer.exe /T

wmic product where "name like 'VirtViewer%%'" call uninstall /nointeractive

exit /B %EXIT_CODE%

Previously, I had used MSI product codes for the uninstall, and got the same result. My original problem, is that there are currently 9 different versions of this app out there, so i am ripping them all out and replacing with 1 version. Installing over an old version does not overwrite the older one, it instead installs a new instance.

 

Reading through the execmgr.log on the client, everything looks as it should. I have attached the execmgr.log to the post.

 

The end result, is that nothing happens. I had originally set the program to run as hidden, but then changed it to normal but still do not see it run. The application is right where i left it, untouched. If i run the script locally it works fine, but not when deployed. Am i missing something??

execmgr.log

  • Author

I just tried using powershell to accomplish the same task, and got the same result. Script ran fine, but nothing resulted. 0 errors in the execmgr.log on the client.

 

 

Program options:

 

Command Line: Powershell.exe -executionpolicy Bypass -file .\VirtUninstall.ps1

 

 

the powershell script looks like this:

$app = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "VirtViewer*"}
$app.Uninstall()
exit /B

Again, the script runs great when launched locally, but not wehen deployed

What if you try:

 

 

taskkill /F /IM remote-viewer.exe /T

%windir%\Sysnative\wmic product
where "name like 'VirtViewer%%'" call uninstall /nointeractive

exit /B %EXIT_CODE%

  • Author

I ended up getting this to work by changing the program environment variables. It was originally trying to uninstall from SYSTEM and was not finding anything. I changed this option to only run when a user was logged in, and run with the users rights and it worked perfectly. This particular program installs on a per user basis, something i was not aware of at the starts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.