Jump to content
DigDeep

Stop specific website from launching

Recommended Posts

Danp2

First thing that comes to mind is to add entries to the Hosts file that point elsewhere.

What's the ultimate goal? Are you trying to keep the kiddies off of porn sites, or is this for business purposes, or what?

Share this post


Link to post
Share on other sites
DigDeep

Business Purpose. I am trying to uninstall some applications which is not a problematic area but at the end of the uninstaller, few websites open with survey links. Which we don't want. 

Share this post


Link to post
Share on other sites
JLogan3o13

Is the application installed through an MSI or EXE?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Danp2

OIC. Simplest option that comes to mind is to close all browsers at the beginning of your script and then monitor / kill any instances that get launched in the interim.

Share this post


Link to post
Share on other sites
DigDeep

@Danp2. If that would have been the case, I wouldn't have posted here :) 

What if there are other sites opened which are important and should not be closed.

 

@JLogan3o13, application is installed through EXE but uninstalled via MSI. So when I run the below command with the keyname, it uninstalls and then launches the sites.

RunWait(@ComSpec & ' /c MsiExec.exe /X{keyname} /qn', "", @SW_HIDE)

 

Share this post


Link to post
Share on other sites
DigDeep

Is there anything we can get for IE? If yes, we can get a go through for other browsers.

 

Share this post


Link to post
Share on other sites
Danp2

This is a function I've used in the past to retrieve the active tab in IE --

;===============================================================================
;
; Function Name:    _IEGetActiveTab()
; Description:      Retrieve the IE Window Object of the currently active tab
; Parameter(s):     None
; Requirement(s):   AutoIt3 V3.2 or higher
;                   On Success  - Returns an object variable pointing to the IE Window Object
;                   On Failure  - Returns 0 and sets @ERROR
;                   @ERROR      - 0 ($_IEStatus_Success) = No Error
;                               - 7 ($_IEStatus_NoMatch) = No Match
; Author(s):        Dan Pollak
;===============================================================================
;
Func _IEGetActiveTab()
Local $hwnd, $i, $title, $oIE

    ; get first IE instance
    $oIE = _IEAttach ("", "instance", 1)

    If @error = $_IESTATUS_Success Then
        ; get window title
        $hwnd = _IEPropertyGet($oIE, "hwnd")
        $title = WinGetTitle($hwnd)

        ;strip off trailing browser text
        $i = StringInStr($title, ' - ', 0, -1)
        If $i > 0 Then
            $title = StringLeft($title, $i - 1)
        EndIf

        $oIE = _IEAttach($title, "windowtitle")
    EndIf

    Return $oIE
EndFunc

You could use this as-is or you could use it as the basis for a function that loops through all tabs and kills any where the title matches a given list.

Share this post


Link to post
Share on other sites
JLogan3o13

I misunderstood your OP, I thought you were just planning to install this and had caught the behavior on uninstall through testing. In that case I would have suggested simply opening the MSI (hidden in the exe wrapper) with ORCA and removing the custom action to open the web page on uninstall. But it sounds like this was missed before installation and you are beyond that point.

More of an overall question, which may also lend itself to your issue, is why you're doing uninstalls during the middle of the day when the users are working? Why not follow best practice and do them overnight, using whatever tool (SCCM, Altiris, etc.) to inform the users there will be the need for a reboot? That would alleviate the problem of seeing the browser window pop up (not to mention a periodic reboot has been shown to cut support calls by a pretty hefty margin in general).


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
ViciousXUSMC

You can still do the process of keeping browsers closed.

Just start the script with a wait so that it does not force kill a browser if its open but instead waits until any pre-existing instances of a browser are closed and then runs the script.

Your other options are to build your own uninstaller :) 

While 1
    If ProcessExists("iexplore.exe") Then
        Sleep(10)
        ContinueLoop
    EndIf
ExitLoop
WEnd

AdlibRegister("_KeepBrowsersClosed")

;Uninstall Script

Func _KeepBrowsersClosed()
    If ProcessExists("iexplore.exe") Then ProcessClose("iexplore.exe")
EndIf

Tweak, add your other browsers, etc.

Possibly have it run at login so it completes before users even get a chance to open a browser. 

Share this post


Link to post
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

×