Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbs, determine if an outlook profile exist

Status
Not open for further replies.

rod602

Technical User
May 16, 2011
66
US
Hi All,

I have a logoff script in my environment that backups pst files and it works great, except when a user doesn't have a outlook profile setup. As they log off the outlook wizard for new account setup starts.

I like to know if I can programmatic-ally determine if there is an outlook profile setup-ed so that I can then stop the script from continuing.

Thank you,
 
If the user has not configured outlook, there will be no Outlook folder in the user's profile.

This work on both XP and 7.

Code:
set objFSO = CreateObject("Scripting.FileSystemObject")
set objNetwork = CreateObject("WScript.Network")
strUsername = objNetwork.Username

strOutlookFolder = "c:\Documents and Settings\" & strUsername & "\Application Data\Microsoft\Outlook"
if (objFSO.FolderExists(strOutlookFolder)) then
    'configured
else
    'not configured
end if

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Hi Geates,

thanks for your reply.

win 7 uses the path c:\users\...

Will this code still work?

Or will it have to be tweaked for win 7?

Rigo
 
Hi Geates,

How about the case where someone did create a profile then removed it. The outlook folder here "c:\Documents and Settings\" & strUsername & "\Application Data\Microsoft\ still remains, even though there is no outlook profile.

So the loggoff script in this case would still try and run the outlook setup wizard -- actually the new profile wizard as I just ran it.

Do you know if any other method or checking ?

Thanks
 
It will still work if the shortcuts still exist. Win7 has hidden shortcuts with WinXP names that point Win7 folders.

Documents and Settings -> Users
Application Data -> AppData

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Microsoft has a free tool for doing this specific task. I would recommend that you use that instead of a scripted solution.




I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top