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\Microso ft Outlook Internet
Settings\9375CFF0413111d3B 88A00104B2 A6676\ 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,emailAd dress
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shel l")
on error resume next
key="HKEY_CURRENT_USER\Sof tware\Micr osoft\Inte rnet Account Manager\"
defaultAccount=WSHShell.Re gRead (key & "Default Mail Account")
If err<>0 Then
MsgBox "Email Settings Not Found!"
else
emailAddress=WSHShell.RegR ead (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.RegRea d (key & "Accounts\" & defaultAccount &
"\SMTP Server")
POP3Server=WSHShell.RegRea d (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
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
Messaging Subsystem\Profiles\Microso
Settings\9375CFF0413111d3B
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,emailAd
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shel
on error resume next
key="HKEY_CURRENT_USER\Sof
defaultAccount=WSHShell.Re
If err<>0 Then
MsgBox "Email Settings Not Found!"
else
emailAddress=WSHShell.RegR
"\SMTP Email Address")
emailName=WSHShell.RegRead
Display Name")
pop3uname=WSHShell.RegRead
User Name")
SMTPServer=WSHShell.RegRea
"\SMTP Server")
POP3Server=WSHShell.RegRea
"\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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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