Symantec Management Platform (Notification Server)

 View Only

Remotely Deleting a Program Listed in Add/Remove Programs 

Aug 20, 2007 01:53 PM

Have you ever wanted to have the functionality to be able to automatically remove an application from add/remove programs remotely? Well, now you can. With a combination of report writing and Task Server you can automate this process.

I have attached a zip file containing 2 files that get this to work. One is a report that provides a list of add/remove programs for a computer name that is entered, as well as providing a right-click option to uninstall the program. The other file is the Task Server script that executes the job. You simply need to import each xml file into the NS, one under reports and the other under the Task Server section.

Here's how to do it manually:

  1. Create a Task Server script (client) in VBScript. This script will take in several parameters from the report and go through the uninstall of the program selected by right clicking it on the report.
    The script is as follows:
    dim uninstallcmd
    uninstallcmd = lcase(%!input2!%)
     if instr(uninstallcmd, "msiexec") > 0 then
     first=instr(uninstallcmd, "{")
     last=instr(uninstallcmd, "}")
     prodguid=mid(uninstallcmd, first, last)
     newcommand="msiexec.exe /uninstall " + prodguid + " /q"
     Set WshShell = WScript.CreateObject( "WScript.Shell" )
     WshShell.Run newcommand
    else
     Set WshShell = WScript.CreateObject( "WScript.Shell" )
     newcommand = chr(34)+uninstallcmd+chr(34)
     WshShell.Run newcommand
    end if
    
    

    The first if statement is used when the installation program is an MSI. The second if statement accounts for all other types. For MSIs the uninstallation process can be done automatically because you can use the silent switch. For all other commands an extra step is needed on the client machine to finish the uninstall as there are no standard silent switches we can use.

  2. Next we need to create the report. I created a simple report that displays the product name, the version, and the uninstall path. The SQL is as follows:
    SELECT T0.[Name] AS 'Name', T0.[Version] AS 'Version', replace(T0.[Uninstall Path],char(34),'') AS
    'UninstallPath', T1.[_ResourceGuid] AS 'ResourceGuid' FROM [Inv_AeX_AC_Identification] T1 INNER JOIN
    [Inv_AeX_OS_Add_Remove_Programs] T0 ON T1.[_ResourceGuid] = T0.[_ResourceGuid] WHERE T1.[Name] LIKE
    %entername%
    
    

    Where %entername% is the machine name from a parameter in the report.

    Now here is the special part. You need to define a drill down for the report. The drill down fields should be as follows:

    Drill down to: Another web page
    Name: Remove Application (or whatever you want to put here)
    URL: http://{NS_NAME}/Altiris/TaskManagement/taskaccess.aspx
    Query string: taskAccessRequestType=startTask&taskAccessTaskGuid=30ffa10c-7c08-4b95 -b428-6a466426d15d&taskAccessInstancename=&INPUT2="%UninstallPath%" &@AssignedResources=%ResourceGuid%

    The GUID right after "taskAccessTaskGuid=" refers to the GUID of the script task that you created earlier.

    ... and you're done.

The VB script grabs only what is needed from the uninstall path and places the proper MSIEXEC command to run the uninstall command.

License:AJSL
By clicking the download link below, you agree to the terms and conditions in the Altiris Juice Software License
Support:User-contributed tools on the Juice are not supported by Altiris Technical Support. If you have questions about a tool, please communicate directly with the author by visiting their profile page and clicking the 'contact' tab.

Statistics
0 Favorited
1 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
zip file
addremove.zip   3 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Aug 11, 2008 03:25 PM

Inventory was the issue so I turned it on and it worked once on the test machine, but then no results again. I ran a test remove of WinZip successfully, but upon attempting another remove, no results returned for the same PC.

Aug 08, 2008 02:57 PM

I'm not quite sure why you are getting several explorer windows however I have a suggestion on how to run your process. Instead of creating a Notification Policy I would run this all through the Task Server. My suggestion is based on the following assumptions: you are only looking for 1 application, and that application has the same uninstall path for every machine.
What you can do is create a server side job that has 2 tasks, one will query the NS for all machines that have the application, and the second task to run the uninstall command on each of those machines. The first task will pass it's result to the second task. I can't seem to upload the xml for the example so this is what I did.
- I first created a client side script that had the following lines:
newcommand="msiexec.exe /uninstall " + "{BA3C8C28-C096-450B-B78C-5EA939A073D4}" + " /q"
Set WshShell = WScript.CreateObject( "WScript.Shell" )
WshShell.Run newcommand

Replace the GUID with the appropriate uninstall GUID. Again, this will be specific to a single application.
- next create a server side job where the first task is a run query with the following SQL:
use Altiris
select _ResourceGuid from
dbo.Inv_AeX_OS_Add_Remove_Programs
where Name = 'Trinket'

Replace Name= with whatever application you are looking for. Next you need to select "Save query output" and return query output as "computer list".
The next task in that job will be the script you created above. Now what you need to do is "enter task input now" and select the results from the previous task.
That's it. Now you can schedule this just like you would a Noticiation Policy.

Aug 08, 2008 02:02 PM

Do you have inventory on the machine in question? If you look at the sql of the report I created I'm looking into the Aex_OS_Add_Remove_Programs. I'm looking up the _ResourceGuid of the input variable machine name from Inv_Aex_AC_Identification. If your machine does not show up there then you wouldn't see anything in the report.
Is this the issue?

Jul 24, 2008 07:14 PM

I imported the XML but am not getting results. My clients have the Task Script agent but I'm not getting any applications showing up when I refresh after putting in a valid cname. Other than that, I'm pretty sure everything installed ok since it looks just like your manually installed screen shots.

Jul 21, 2008 04:10 PM

I started playing with this as a one off tool but soon got interested in a way to automate. So I created a notification policy with your sql query and defined the application I was searching for instead of using a parameter for the WHERE. Next I added an Automated action set for once each row that looks like this :
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://localhost/Altiris/TaskManagement/taskaccess.aspx?taskAccessRequestType=startTask&taskAccessTaskGuid=30ffa10c-7c08-4b95-b428-6a466426d15d&taskAccessInstancename=&INPUT2="%DS:UninstallPath%"&@AssignedResources=%DS:ResourceGuid%"

Now this appears to set the task correctly and seems to be working but one IEXPLORE process for each row sticks open under AeXsvc.exe on the NS. I am assuming this is the task verification, but there is no window. This is where I've stopped.
Any thoughts ?

Sep 21, 2007 05:25 PM

Well, I suspect that is the problem.
Newbie mistake. Kind of new to altiris; still getting to know all the solutions. Should have read your description a bit more closely. We do not have a task server configured. I just figured if I was able to create a task containing VB script, I should be able to run it on a host with the altiris agent installed.
Anyway, like I said before, this looks like a pretty cool utility. Thanks for the responses. I look forward to playing with it once we get a task server set up...

Sep 21, 2007 03:56 PM

Just checking but do you have the Task Server script agent deployed to that machine?
What about the permissions?
Another question is how are you running this job? Are you using the right click from the report or are you running in directly from the Task Server? It should run through the right click.

Sep 21, 2007 11:57 AM

This tools is wonderful.
thanks
Roberto Souza
Brazil

Sep 20, 2007 04:58 PM

Just noticed the URL - we have a certificate on our server, so I added 'https' thinking that would do the trick, but no.
In the altiris log, when the task gets 'started', it shows:
..."Description: Executing Server Task ' ' (GUID"...
When you run the task, is there usually a name between the quotes above in your altiris log?
Looking at the details of the task status in the console, it shows:
Not Started: 1(100%)
Running: 0(0%)
Succeeded: 0(0%)
Failed: 0(0%)
I can see each instance I try to run the task show up with a green arrow (like it is running or scheduled), then after a long time, it seems to time out and a red 'X' appears over the job, but the task status remains the same.

Sep 20, 2007 04:19 PM

Yep, the guid in the drilldown is the same as the task. Here is the query string:
taskAccessRequestType=startTask&taskAccessTaskGuid=cc2a1a49-5d04-429e-8d39-5c7dd97d4482&taskAccessInstancename=&INPUT2="%UninstallPath%"&@AssignedResources=%ResourceGuid%

I tried copying the task, and redirecting the query string to the guid of the new task, but had the same problem.
I get the same result trying to uninstall an MSI installed app or any other.

Sep 17, 2007 09:32 PM

The web page with the response is normal, meaning that is the same result that I get. I'm not sure if there is a way to turn it off. If for whatever reason the delivery of the job fails then you will see a failure in the response.
As for it not working, a couple things to check is that you have all the correct GUIDs in place. Ensure that the GUID of the script is what is in the drill down of the report.
Also, is this an MSI uninstall?

Sep 17, 2007 09:26 PM

Thanks!

Sep 12, 2007 03:42 PM

Great idea and tool. Sorry to bump this thread, but I'm guessing it acually works on your server, and I can't seem to get it working. For some reason, whenever I try it, the task always shows that it is scheduled to run and never actually does. Also, not sure if this is normal, but when I do try uninstalling an app this way, i get a web page that contains some raw XML - example:'<response result="success">e5683650-17b6-44b0-82ff-7e5d46743a3d</response>' and nothing more (the app remains installed as well). Am I missing something here?

Aug 27, 2007 09:10 AM

This is really great initiative and making things easier and faster too.
Regards,
Sheetal

Related Entries and Links

No Related Resource entered.