I am trying to use vbscript to pull the path out of a registry export and use that path to add the Outlook PST file to outlook automatically -
i have run batch file on of our users regexport key has of pst locations outlook. issue exports in way makes hard read each line current script , add outlook. there way read paths this:
[hkey_current_user\software\microsoft\office\15.0\outlook\search\catalog] "c:\\users\\tratliff\\appdata\\local\\microsoft\\outlook\\outlookdata file - default.ost"=hex:b4,\ 0e,02,00,00,00,00,00 "c:\\users\\tratliff\\appdata\\local\\microsoft\\outlook\\trevor.ratliff@company.com - default.ost"=hex:cc,\ e1,01,00,00,00,00,00 "c:\\users\\tratliff\\documents\\outlook files\\archive.pst"=hex:3c,6a,00,00,\ 00,00,00,00 "c:\\users\\tratliff\\appdata\\local\\microsoft\\outlook\\tratliff@company.com - default.ost"=hex:a0,\ e9,24,00,00,00,00,00 "c:\\users\\tratliff\\appdata\\local\\microsoft\\outlook\\tratliff@company.com - trevor.ost"=hex:c4,\ 05,23,00,00,00,00,00 "c:\\users\\tratliff\\documents\\outlook files\\archive1.pst"=hex:64,11,00,00,\ 00,00,00,00 "c:\\users\\tratliff\\documents\\outlook files\\backup.pst"=hex:70,04,07,00,00,\ 00,00,00 "c:\\users\\tratliff\\appdata\\local\\microsoft\\outlook\\trevor.ratliff@company.com - hii-tsd.ost"=hex:bc,\ 12,0f,00,00,00,00,00 "c:\\users\\tratliff\\documents\\outlook files\\archive2.pst"=hex:84,07,00,00,\ 00,00,00,00 "c:\\users\\tratliff\\appdata\\local\\microsoft\\outlook\\trevor.ratliff@company.com - ter.ost"=hex:fc,\ a0,00,00,00,00,00,00
into similar can create loop , read each line path input this?
set objfso = createobject("scripting.filesystemobject") set objnet = createobject("wscript.network") set olkapp = createobject("outlook.application") set objshell = createobject("wscript.shell") userprofilepath = objshell.expandenvironmentstrings("%userprofile%") set objfolder = objfso.getfolder(userprofilepath & "\documents\outlook files") each objfile in objfolder.files if lcase(objfso.getextensionname(objfile.name)) = "pst" olkapp.session.addstore objfile.path end if next msgbox "done"
Comments
Post a Comment