Reading Outlook Account Details With WSH/VBScript
Posted on 2005-05-01
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:
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 (firstname.lastname@example.org)
' Many thanks Michelle!
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
pop3uname=WSHShell.RegRead (key & "Accounts\" & defaultAccount & "\POP3
SMTPServer=WSHShell.RegRead (key & "Accounts\" & defaultAccount &
POP3Server=WSHShell.RegRead (key & "Accounts\" & defaultAccount &
'MessageText="Your Default Email Address is " & emailAddress & " (" &
emailName & ")"
' ********* END CODE