Announcement

Collapse
No announcement yet.

Script for displaying hostanem in ie 7.0 browser title

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script for displaying hostanem in ie 7.0 browser title

    Hi all,

    I am not sure if yhis is possible, but is there any way to display the hostname of a pc in the browser title bar of Internet explorer 7.0? Or maybe in the registry with a hack of some sort? So it needs to work with some kind of variable. I really hope it is possible.

  • #2
    Re: Script for displaying hostanem in ie 7.0 browser title

    Have a look at this link http://javascript.internet.com/user-...roperties.html

    It shows how to get the host name and the IP address in Javascript - once you have that info, you can display it in a number of ways, such as the status bar or as an alert box, it's up to you. I am not sure how you would get it into the browser title, however, but that link helps to show you how to get it into a Javascript variable.

    Edit: Sorry, being a bit dumb this morning, you can then just set the TITLE HTML tag of your page using the Javascript variable for the PC's hostname.
    Last edited by PaulH; 6th March 2008, 11:39.
    Best wishes,
    PaulH.
    MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

    Comment


    • #3
      Re: Script for displaying hostanem in ie 7.0 browser title

      thanks paul but this seems to edit a certain webpage, what we want to have is that no matter where the user browses to he getshis hostname somewhere shown in the titlebar of ie 7.0. I appreciate your help. I know wit ha policy you can get some text in there, but is it possible through some kind of tweak to get the hostname there, per workstation.

      Edit: I have to add I am not good at scripting so bear that in mind
      Last edited by davegbr; 6th March 2008, 12:51.

      Comment


      • #4
        Re: Script for displaying hostanem in ie 7.0 browser title

        Oh yes, right I see what you mean. That's called "Branding Internet Explorer" and you can get a free utility to change the title bar text from here http://www.fixieonline.com/titlefix/ but I have no idea if it will put the hostname in. You'll need to play with it to see its capabilities - if it can read text from a file, you could store the PC name in a file and do it that way, but I don't know. If it can run on a command line, that would be another way to do it. But if it is just a GUI then it's not going to be of much use to you.

        Also try searching Google on "Branding Internet Explorer" to see what comes up there.

        You can set the key named "Window Title" (yes with a space) in the registry at HKEY_LOCAL_MACHINE\ Software\ Microsoft\Internet Explorer\Main. How many PCs are you talking about? If only a few, go to each one and manually edit the registry, otherwise I bet someone here will have a good idea on how to roll it out in a script to many PCs.
        Best wishes,
        PaulH.
        MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

        Comment


        • #5
          Re: Script for displaying hostanem in ie 7.0 browser title

          Thanks Paul but I seem to stumble on dead ends. Wshen I look for internet branding it brands the names perfectly but nowhere a variable to brand the hostname. Does anyone know a devious thing I could do to get the desired result?

          Comment


          • #6
            Re: Script for displaying hostanem in ie 7.0 browser title

            Yes, but I believe it would be possible to create a script that does this:

            1. Get the hostname into a variable
            2. Edit the registry so that the setting mentioned in my previous post is altered to include the hostname.

            I do not know, however, if it would take place immediately - you could include it in a startup script so that if the hostname changes, which requires a restart, it would be corrected to the new name.
            Best wishes,
            PaulH.
            MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

            Comment


            • #7
              Re: Script for displaying hostanem in ie 7.0 browser title

              Does this work for you? You have to have rights to edit the registry key, and it may require a restart, I don't know for sure...

              Code:
              option explicit
              On Error Resume Next
              Dim objShell, HostName, RegKey, WshNetwork
              
              Set objShell = WScript.CreateObject("WScript.Shell")
              Set WshNetwork = WScript.CreateObject("WScript.Network")
              
              HostName = WshNetwork.ComputerName
              
              RegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\Window Title"
              
              objShell.RegWrite RegKey,HostName,"REG_SZ"
              Best wishes,
              PaulH.
              MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

              Comment


              • #8
                Re: Script for displaying hostanem in ie 7.0 browser title

                After a bi tmore testing on Vista, I realised you may need to replace the registry key that is edited by the script with this:
                Code:
                RegKey = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\MAIN\Window Title"
                I suppose it depends on whether you are on Vista or XP. Try each in turn and see which works for you. You only have to close and reopen IE7.
                Best wishes,
                PaulH.
                MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

                Comment


                • #9
                  Re: Script for displaying hostanem in ie 7.0 browser title

                  Paul you absolutely know your stuff!! This worked like a charm. However oddly enough in thsi script:

                  option explicit
                  On Error Resume Next
                  Dim objShell, HostName, RegKey, WshNetwork

                  Set objShell = WScript.CreateObject("WScript.Shell")
                  Set WshNetwork = WScript.CreateObject("WScript.Network")

                  HostName = WshNetwork.ComputerName

                  RegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Interne t Explorer\MAIN\Window Title"

                  objShell.RegWrite RegKey,HostName,"REG_SZ"


                  I replaced the HKEY_LOCAL_MACHINE value for Hkey current user and that works. The value window title in HKLM doesn't seem to do anything with IE 7.0 title even though I can see the value being written there in teh registry. It only seems to work on the HKCU level.

                  Perfect stuff. The only question I have now is do you know a good source on teh web where I can find out more about VBS scripting? Or a book. Thanks again!

                  Comment


                  • #10
                    Re: Script for displaying hostanem in ie 7.0 browser title

                    Yes, as mentionem post #8. So glad it worked for you

                    Fortips, try http://www.computerperformance.co.uk/vbscript/index.htm
                    Best wishes,
                    PaulH.
                    MCP:Server 2003; MCITP:Server 2008; MCTS: SBS2008

                    Comment

                    Working...
                    X