Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Reading Outlook Account Details With WSH/VBScript

Posted on 2005-05-01
Medium Priority
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 (mhillard@craized.tv)
' 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

ID: 13910239
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

nonubik earned 2000 total points
ID: 13915743
I think the binary values are Unicode strings (2 byte character)

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

571 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