How to export all URLs of Internet Explorer tabs at once (VBScript)

Introduction

This script sample can get all current url of tabs in Internet Explorer and supports automatically open the last opened urls.

Scenarios

When you opened many tabs in Internet Explorer but need to stop for the day, or maybe you just updated your computer followed by the inevitable 'Restart your computer to finish installing updates' message. At this point, you must close the browser session with gazillion tabs, you have to temporarily record the URL of each IE tabs that you want to open in the next session. We usually manually copy of each tab URL, it's really time-consuming. This script will help users to export all Internet Explorer tabs and tab titles. It's really useful for users.

Script

Step1: For this example, we have opened three tabs in Internet Explorer.

Let's run the script, double-click IETabAddress.vbs to run this VBScript sample. The step is shown in the following figure.

When the script finishes running, it shows brief information as blow:

The script generates a  IEUrls.csv file on the current root directory. We can also open this file in Notepad.

Here are some code snippets for your references.

VB Script
Edit|Remove
If objShellWindows.Count = 0 Then 
    WScript.Echo "Can not find any opend tabs in Internet Explorer." 
Else 
    Set objExportFile = objFSO.CreateTextFile(currentDirectory & "IEurls.csv", ForWriting, True) 
    objExportFile.WriteLine "URL" & "," & "Title" 
     
    For Each objItem In objShellWindows 
        FileFullName = objItem.FullName 
        objFile = objFSO.GetFile(objItem.FullName) 
        objFileName = objFSO.GetFileName(objFile) 
         
        If LCase(objFileName) = "iexplore.exe" Then 
            LocationURL = objItem.LocationURL 
            LocationName = objItem.LocationName 
            objExportFile.WriteLine LocationURL & "," & LocationName 
        End If 
    Next 
     
    WScript.Echo "Successfully generated IEurls.csv on " & currentDirectory 
End If

Prerequisite

Windows PowerShell 2.0
Windows 8 or higher version

Microsoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.