Jump to content

Script fails to run using SCCM required package


Annmdc
 Share

Recommended Posts

Thanks for the great tool and the help.  I have been digging through the forum and cannot seem to find an answer that works. I have a script designed to uninstall an application that doesn't have a silent uninstall option. The script works without issue when run outside of SCCM but when run via SCCM as a required install ( run as admin) it fails to run. The issue is the window does not maintain focus. For testing purposes I allow users to interact with the install so I can see the window appear--as soon as I click the window the package completes. I have tried WinActivate with sleep and Controlclick but no luck.   Is there a trick in running the autoit EXE  using SCCM?  Sorry I know there are several threads on this but I am having issue finding my answer.  I would appreciate your help. Thanks much. 

Link to comment
Share on other sites

  • Developers

I would think you just need to adhere to the rules of a background job ran without any screen interaction like ran with the scheduler or using other credentials.
eg, don't use send()  and mousexxx() commands. Maybe it would be helpfull when you show the source you have?

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

@Annmdc, Jos is quite right, and I can feel your pain; those one-off apps can be a pain through SCCM. Is the application something available on the net, or a home-grown app? If it is available online I would gladly throw it into my SCCM lab and see what we can do to assist your efforts.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks for your continued help. 

I am testing the removal of WinPcap (from servers), which is ,of course, designed for security purposes to avoid silent uninstalls/ installs.  I have been through several iterations of this very simple script.  I have added 'sleep' intervals to see if it is an issue of timing--no luck.  It is an issue with maintaining focus.  Each of the scripts below work without issue when run outside of SCCM.  I would appreciate your help.  I will keep digging too.  Thank you!

#RequireAdmin
; Run the uninstall.exe
Run("C:\Program Files (x86)\WinPcap\uninstall.exe")
WinActivate("WinPcap 4.1.2 Uninstall")
ControlClick("WinPcap 4.1.2 Uninstall", "Uninstall WinPcap 4.1.2", "[CLASS:Button; INSTANCE:2]")
WinWaitActive("WinPcap 4.1.2 Uninstall", "Completing the WinPcap")
Send("!f")

I have used the following also:

#RequireAdmin
; Run the uninstall.exe
Run("C:\Program Files (x86)\WinPcap\uninstall.exe")
WinActivate("WinPcap 4.1.2 Uninstall")
WinWaitActive("WinPcap 4.1.2 Uninstall")
Send("!u")
WinWaitActive("WinPcap 4.1.2 Uninstall", "Completing the WinPcap")
Send("!f")

 

Link to comment
Share on other sites

  • Developers

You do still have a send() in both which for sure will fail.  There is no need to worry about the focus of a window when using ControlClick() or ControlSend(), so do you have any idea yet at which statement it is hanging?  (might want to add debugging by writing to a file after each statement)

Here's what you could start with:

#RequireAdmin
; Run the uninstall.exe
Run("C:\Program Files (x86)\WinPcap\uninstall.exe")
Winwait("WinPcap 4.1.2 Uninstall")
sleep(1000) ; give is some time to build the window)
ControlClick("WinPcap 4.1.2 Uninstall", "Uninstall WinPcap 4.1.2", "[CLASS:Button; INSTANCE:2]")
;  no need for this.. WinWaitActive("WinPcap 4.1.2 Uninstall", "Completing the WinPcap")
; replace this by a control click or controlSend ==> Send("!f")
winwait("Proper title", "proper text")
sleep(500)
ControlClick("Proper title", "proper text", "proper button  [CLASS:Button; INSTANCE:2]")

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Jos, thank you so much for helping me.  It was failing immediately after calling the Uninstall.exe.  The script you provided worked perfectly!    (Just a tidbit for others who may be struggling--I did find through testing that this package would not complete unless the option to "Allow users to interact with this program" was selected.)  I really appreciate you taking the time to help me.  Thanks again. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...