Link to home
Start Free TrialLog in
Avatar of bytesize_2004
bytesize_2004

asked on

Reading Outlook Account Details With WSH/VBScript

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
solution!!

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

John



' *********** 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!"
else
     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
Avatar of bytesize_2004
bytesize_2004

ASKER

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....!

John
ASKER CERTIFIED SOLUTION
Avatar of nonubik
nonubik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial