Scripting: Adding PST files to an outlook profile automatically

This script will allow you to add all PSTs in a txt file (full path).

 On error resume next
     Const ForReading = 1 
     Dim arrFileLines() 
     Dim objNetwork,ObjFSO,objFile,objNet,objOutlook
     
     i=0
     
     Set objnet = CreateObject("wscript.network")
     Set objFSO = CreateObject("Scripting.FileSystemObject") 
     Set objFile = objFSO.OpenTextFile("c:\users\marcdek\temp\"& objNet.Username & "-PSTOUTPUT.txt", ForReading) 
     Set objFSO = CreateObject("Scripting.FileSystemObject")
     Set objOutlook = CreateObject("Outlook.Application") 
  
     Do Until objFile.AtEndOfStream 
         Redim Preserve arrFileLines(i) 
         arrFileLines(i) = objFile.ReadLine 
                 i = i + 1 
     Loop 
     
     objFile.Close
     
     For Each strPath in arrFileLines 
          objOutlook.Session.Addstore strPath
     Next  

And if you want to add a selection to only add local PST files you use the following:

 On error resume next
     Const ForReading = 1 
     Dim arrFileLines() 
     Dim objNetwork,ObjFSO,objFile,objNet,objOutlook
     
     i=0
     
     Set objnet = CreateObject("wscript.network")
     Set objFSO = CreateObject("Scripting.FileSystemObject") 
     Set objFile = objFSO.OpenTextFile("c:\users\marcdek\temp\"& objNet.Username & "-PSTOUTPUT.txt", ForReading) 
     Set objFSO = CreateObject("Scripting.FileSystemObject")
     Set objOutlook = CreateObject("Outlook.Application") 
  
     Do Until objFile.AtEndOfStream 
         Redim Preserve arrFileLines(i) 
         arrFileLines(i) = objFile.ReadLine 
                 i = i + 1 
     Loop 
     
     objFile.Close
     
     For Each strPath in arrFileLines 
          Select Case True
             Case InStr(strPath,":\") > 0  
                 objOutlook.Session.Addstore strPath
             Case InStr(strPath,"\\") > 0  
             End Select
     Next