Reading Outlook Account Details With WSH/VBScript

Posted on 2005-05-01
Last Modified: 2013-12-03
Hello everyone,

  I am trying to read the Outlook 2000/XP account details from the registry
using VBScript (WSH specifically), so I can then import the information into
an asset management tool. The script below works perfectly for Outlook
Express, but for Outlook the values are stored as reg_binary, and when I run
the script I only get the binary string returned (or more often a whole
bunch of frustrating errors!!!)

The Outlook profile date is stored in:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Messaging Subsystem\Profiles\Microsoft Outlook Internet
Settings\9375CFF0413111d3B88A00104B2A6676\ and there are sometimes
multiple profiles folders held below this level so the script must be able to
enumerate the settings in each profile folder.

  Could someone please show me how to transform the binary string values
into a text string similar to the script below? I have spent about a week
trying all sorts of code from just about every source and none of it
works!!! From searching on the web I have noticed a lot of people trying to
do the same thing and failing, so it would be great to finally have a

  Many, many thanks in advance, and I hope you all have a nice day!


' *********** BEGIN CODE
' Code originally by Michelle Hillard (
' Many thanks Michelle!

dim key,defaultAccount,emailAddress

Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

on error resume next
key="HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\"
defaultAccount=WSHShell.RegRead (key & "Default Mail Account")

If err<>0 Then
     MsgBox "Email Settings Not Found!"
     emailAddress=WSHShell.RegRead (key & "Accounts\" & defaultAccount &
"\SMTP Email Address")
     emailName=WSHShell.RegRead (key & "Accounts\" & defaultAccount & "\SMTP
Display Name")
     pop3uname=WSHShell.RegRead (key & "Accounts\" & defaultAccount & "\POP3
User Name")
     SMTPServer=WSHShell.RegRead (key & "Accounts\" & defaultAccount &
"\SMTP Server")
     POP3Server=WSHShell.RegRead (key & "Accounts\" & defaultAccount &
"\POP3 Server")

     'MessageText="Your Default Email Address is " & emailAddress & " (" &
emailName & ")"
     'MsgBox MessageText

wscript.echo emailAddress
wscript.echo emailName
wscript.echo pop3uname
wscript.echo SMTPServer
wscript.echo POP3Server

end if
' ********* END CODE
Question by:bytesize_2004

    Author Comment

    Surely somebody out there knows the answer to this question? If I could assign more points to the answer, then I would!!!

    If it makes things easier, then just show me how to convert these reg_binary entries into an ASCII text string, and I'll figure the rest out from there....!

    LVL 16

    Accepted Solution

    I think the binary values are Unicode strings (2 byte character)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
    This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now