Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript to redirect to a new IE page. 1

Status
Not open for further replies.
Mar 25, 2004
146
US
My question is does anyone know of a script to redirect IE client side. I'm using systrack to run a script when a user types in a restricted URL in IE. Once this happens I can run a script and was wondering if there was a vb script that could just redirect the page to a company rules page when this happens. My other option is the kill the process which will work but I'd rather them know what they've done rather than just have IE close.

All users will be using the latest version of IE.

THX
 
Isn't this the same question that you asked here:
thread329-860200

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
not really....I'm needing help redirecting now becuase the process kill will work but I would like to have it redirect...my title didn't say anything about redirecting so I'm hoping to get some help.

Thx for noticing though[thumbsup2]
 
Do you know if systrack will be able to give the explorer process id to the script you execute?

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
AFAIK, this would be the only way to reliably redirect the browser. If the user has more than one browser open, it gets tricky to make sure you redirect the one they are using. Another possibility is to kill every browser process but one then grab it, redirect it, and maximize it. That should get the point across.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Hello NetworkAdmin123,

If you can spawn an activedesktop shell app, this is how you can detect and redirect.
Code:
'const surl="[URL unfurl="true"]http://server/page1.htm"[/URL]
'const surl_redir="[URL unfurl="true"]http://server/page2.htm"[/URL]
const surl="[URL unfurl="true"]http://www.microsoft.com"[/URL]
const surl_redir="[URL unfurl="true"]http://tek-tips.com"[/URL]

set shapp=wscript.createobject("Shell.Application")
on error resume next
set oie_id=nothing : set cwins=nothing
set cwins=shapp.windows
if err.number<>0 then wscript.echo err.number & vbcrlf & err.description : wscript.quit(1)
if cwins is nothing then wscript.echo "No active desktop? Quit." : wscript.quit(2)
for each owin in cwins
    if strcomp(typename(owin.document), "htmldocument",1)=0 then
        if instr(1,owin.locationURL,surl,1)<>0 then
            set oie_id=owin
            exit for
        end if
    end if
next
on error goto 0
set cwins=nothing : set shapp=nothing
if oie_id is nothing then
    'wscript.echo "No iWebBrowser2 instance is found surfing " & surl & "."
else
    oie_id.navigate surl_redir
end if
set oie_id=nothing
regards - tsuji
 
Nice solution tsuji! Have a star. :)

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
they said it should work. I sent them this code and they replied with these remarks. I'm not very good at coding vbscript...is there a way to do what they are saying?

The code I sent......................
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'iexplore.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
'continue from the line of "next" above
getobject("winmgmts:\\" & strComputer & _
"\root\cimv2:win32_process").create _
"explorer " & "
Here is their reply:

After looking at it again, the big problem I see is that he is creating an instance of "explorer.exe" and not "iexplorer.exe". You can drop an URL into explorer without calling up the interface. He needs to create a proper instance of "iexplorer" (Internet Explorer).



He could also change how he is terminating IE. His method will shut down all instances of IE, instead of the one that generated the SysTrack alarm. He could just grab the Process ID of the IE instances, and terminate the last one instead of killing all instances. He can even get the URL info from the IE, and terminate the offending instance.
 
You should probably pick one of your two threads on this and stick with it.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top