Remove software on windows server

(imported topic written by garretdavis91)

I’m trying to remove some software via an action script and I cannot seem to get the action script correct. I told log into a cmd prompt and just run “cscript oainstall -r -a” and the software would get removed without any intereaction. Well even with my poor knowledge of action scripts I thought I could do it quickly and it would seem I cannot. Below are the different things I have tried. What the heck am I missing.

wait “{pathname of system folder}\cscript.exe” “C:\Program Files\HP\HP BTO Software\bin\win64\OpC\install\oainstall.vbs” -r -a

wait cmd.exe /c “{pathname of system folder}\cscript.exe” C:\Program Files\HP\HP BTO Software\bin\win64\OpC\install\oainstall.vbs -r -a

wait cmd.exe /c “{pathname of system folder}\cscript.exe” “C:\Program Files\HP\HP BTO Software\bin\win64\OpC\install\oainstall.vbs” -r -a

wait “{pathname of system folder}\cscript.exe” “C:\Program Files\HP\HP BTO Software\bin\win64\OpC\install\oainstall.vbs -r -a”

(imported comment written by garretdavis91)

UPDATE:

I changed my tatics and did an appendfile instead to create a batch file and then tried to run that instead. It said it completed and in the log states exit code 0, but the software was still there. Here are the lines of code:

appendfile cscript.exe “C:\Program Files\HP\HP BTO Software\bin\win64\OpC\install\oainstall.vbs” -r -a

move __appendfile C:\temp\HPOVremove.bat

wait “C:\temp\HPOVremove.bat”

Since the software was still there I ran the bat file by hand and it worked just fine. Why would the bat file not execute, but yet the log file say all is OK and the job completes?

(imported comment written by jeremylam)

Windows batch files don’t really report if their commands have failed. I’ve found that they tend to make it more difficult to write actions, since they will always claim to have completed.

You might want to try redirecting the output of the bat file to a log file so any error input will be saved:

wait “C:\temp\HPOVremove.bat” >> remove.log

(imported comment written by garretdavis91)

Jeremy Lam

Windows batch files don’t really report if their commands have failed. I’ve found that they tend to make it more difficult to write actions, since they will always claim to have completed.

You might want to try redirecting the output of the bat file to a log file so any error input will be saved:

wait “C:\temp\HPOVremove.bat” >> remove.log

OK, so I redirected and this is what I got in the file. What I put in the action was "waithidden “C:\temp\HPOVremove.bat” > c:\temp\hpremove.log 2> c:\temp\hpremoveerror.txt

" and the error file did get created, but it’s empty.

I also added “action uses wow64 redirection true” into the action per other things I have read to see if that was the issue.

C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\CustomSite_GCS_Content>cscript.exe “C:\Program Files\HP\HP BTO Software\bin\win64\OpC\install\oainstall.vbs” -r -a

Microsoft ® Windows Script Host Version 5.8

Copyright © Microsoft Corporation. All rights reserved.

Using system temp for logging

INFO: Refer log file for progress details

INFO: Use the HP Operations-agent media for uninstallation

INFO: Changes made in system environment variables will be effective in new shell

(imported comment written by garretdavis91)

I resolved this by not trying to run VBS script and run an excutable instead. THe syntax was correct the first time and it just did not like running a VBS script I guess.

(imported comment written by SystemAdmin)

One common gotcha’ is that the client runs in the SYSTEM context. When you run your tests by hand you are usually running as a user. It may be that the current user is configured to handle running this script, while the SYSTEM does not.

(imported comment written by garretdavis91)

Zak Kus

One common gotcha’ is that the client runs in the SYSTEM context. When you run your tests by hand you are usually running as a user. It may be that the current user is configured to handle running this script, while the SYSTEM does not.

So how do I resolve that issue?

I still cannot get this to work…how frustrating!