RaphAlv Respected Contributor.
Respected Contributor.
105 views

Remove Software Automate Calls

Trying to automate the software removal by method tru SA, according to help/usage goes below:
/opsw/Server/@/<myserver>/method/startUninstallSoftware --help
Usage:
JOBREF startUninstallSoftware self=POLICYATTACHABLEREFERENCE installables=INSTALLABLEREFERENCE[] userTag=STRING notification=JOBNOTIFICATION schedule=JOBSCHEDULE

So far I understood, that requires
software policy name, containing software to remove?
the installables (which I guess is exactly the MSI/EXE) from the inventory pushed by bs_software run?
userTag ???
notification ???
schedule is when job starts, but what format is this?

Could you please inform an instance of this? There is no documentation inside 'HP SA - Developer Guide.pdf' concerning this action.

BR
Raphael

0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

Re: Remove Software Automate Calls

A software uninstall works the same way as a software install.  I don't an uninstall example to hand but I do have an install.   I would suggest you code in python for this activity instead of trying to use the OGFS api's and shell script to do the same task.

The API is documented in more detail via  https://coreip/twister  the same Java API documentation is applicable to pytwist and the OGFS methods you just need to do a little conversion.

#!/opt/opsware/bin/python
import pytwist
from pytwist.com.opsware.swmgmt import SoftwareInstallJobArgument
from pytwist.com.opsware.swmgmt import InstallableAttachableEntry
from pytwist.com.opsware.pkg import ZIPRef
from pytwist.com.opsware.server import ServerRef
t = pytwist.twistserver.TwistServer()
t.authenticate("user", "password")
s = SoftwareInstallJobArgument()
e = InstallableAttachableEntry()
e.setInstallables([ZIPRef(625260001)])
e.setPolicyAttachables([ServerRef(2280001)])
s.setInstallableAttachableEntries([e])
print t.swmgmt.SoftwarePolicyService.startInstallSoftware(s)

 A Job schedule can be setup like this

import time
from pytwist.com.opsware.job import JobSchedule
jobSchedule = JobSchedule()
jobSchedule.setStartDate(long(time.time() + 60)) # run it 1 minute from now

 The userTag is just some arbitrary piece of data you wish to be associated with the JOB you are submitting to SA.   This might be your companies internal TICKET number associated with the request.

Highlighted
Michael_it Honored Contributor.
Honored Contributor.

Re: Remove Software Automate Calls

./startUninstallSoftware installables:i="com.opsware.pkg.ZIPRef:<packageobjectid>" userTag=deinstall3

 

when you call startUninstallPackage   within the path of the server (e.g. /opsw/Server/@/<servername>/method) you don't need to specify self. self is only needed when you start the method from /opsw/api/com/opsware/.....

 

the installables takes an array of packages you want to remove :i says you specify them by id. as installables accepts different types packages you need to specify the exact type of the reference object

e.g. com.opsware.pkg.ZIPRef

com.opsware.pkg.RelocatableZIPRef

see twister api Doc

https://<sacoreip>/twister/docs/index.html

 

 

ID is the objectID of the package

 

userTag is just a name for the job will show up in Ticket ID of the Job

 

RaphAlv Respected Contributor.
Respected Contributor.

Re: Remove Software Automate Calls

Thanks Michael
packageobjectid could be gathered by 'method/getInstalledSoftware', at least that's the reason to list software details. In https://coreserverip/twister/docs/index.html there is no field of Id.
---
Basically MSI type collects some of the below, anyway trying to code something with WMIC utility to remove

method/getInstalledSoftware outcome is...
packageName="Microsoft Visual Studio Setup Configuration 1.9.77.53636"
status="OK"
name="Microsoft Visual Studio Setup Configuration"
uninstallable=true
type="MSI"
displayName="Microsoft Visual Studio Setup Configuration"
beginDate="2017/10/18 15:34:40.000"
release=
version="1.9.77.53636"

BR
Raphael
0 Likes
Michael_it Honored Contributor.
Honored Contributor.

Re: Remove Software Automate Calls

if i get it correctly you try to desinstall a software which was not managed by SA. so installed outside of SA.

the function startUninstallSoftware is deinstalling software that has a package representation in SA. i dont think you can deinstall "unmanaged" SW that way. in case of an MSI you might be able to get it done by first creating a package represenation in SA get SA to recognize its already installed…. a proper MSI should not be installed again… then you could use uninstall…. but when you really just want to get it deinstalled call msiexec /uninstall <file.msi> 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.