Using Powershell to attach PST files

I have used PowerShell to attach PST files to outlook in the past. Is there a way to write a script that would attach all PST files in a target folder to outlook?

Why yes there is.  What scripts have you tried so far?  It is easiest in VBA.  For VBA post in the Office VBA developers forum.
If you want a different solution you will have to provide your script or at least the part you are having trouble with.
¯\_(ツ)_/¯

Similar Messages

  • PST file in CLOSED folder

    Outlook stopped working because it could not find the PST file.
    It is located in \Users\Name\Documents\CLOSED\Outlook Files
    What is this CLOSED folder?

    Hi,
    Which version of Outlook are you using? Which type of email account are you using? POP3, IMAP or Exchange?
    Is \Users\Name\Documents\CLOSED\Outlook Files the location you see in the error message or the location you used to store your PST files?
    Have you tried navigate to \Users\Name\Documents\CLOSED\Outlook Files and check if you can find your PST file?
    Please provide more information about this issue so that we can resolve it more efficiently.
    Thanks,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Replace document properties using powershell

    Hello ,
    I have document library. It has one column of categories. There are multiple categories tagged for many document .I want to replace some old categories with new one using powershell.
    In other words, first i need to check if that item column has that property if yes replace it with new property. 
    I dont want to change properties manually as this need checking out document. 
    Please guide. powershell script will be helpful for me.

    http://blogs.msdn.com/b/paulking/archive/2011/10/04/using-powershell-scripts-to-modify-document-properties-in-sharepoint-2010.aspx
    # Load SharePoint library
    [system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint")
    # Connect to the site collection http://SP2010 and store the object in the $site variable
    $site = New-Object Microsoft.SharePoint.SPSite("http://SP2010")
    # Connect to the root site in the site collection and store the object in $root
    $root = $site.rootweb
    # Store the Shared Documents document library in a variable $Docs
    $docs = $root.lists["Shared Documents"]
    # Display all the documents, their titles, names and IDs
    $docs.items | format-table -property title,name,id
    # Updates the title for each item in the list with Name
    $docs.items | ForEach { $_["Title"] = $_["Name"]; $_.Update() }
    # Display all the documents, their titles, names and IDs
    $docs.items | format-table -property title,name,idOr try http://sharepoint.stackexchange.com/questions/78084/how-to-update-document-meta-data-using-powershell$listItem = $web.GetListItem($file.ServerRelativeUrl);
    $listItem.File.Checkout();
    $listItem.Properties['My Cust Prop 1'] = 30
    $listItem.Properties['My Cust Prop 2'] = '2012-10-25T00:00:00Z'
    $listItem.Update();
    $listItem.File.Checkin('Updated')http://sharepoint.stackexchange.com/questions/61159/get-document-properties-keys-valuehttp://social.technet.microsoft.com/Forums/ro-RO/db9191e4-c1b6-4d4b-aa58-a352da1839fc/powershell-script-to-create-document-libraries-with-specific-properties?forum=sharepointadminprevious
    If this helped you resolve your issue, please mark it Answered

  • Sharepoint lists.pst files

    I need to understand how and why share point lists are created.
    There are a number of users in my organisation who have them associated with the user accounts and as part of a strategy to migrate Outlook PST into exchange these files these have become an issue.
    Also I need to get some advice on how to manage them can I import theme into outlook and then disable the use of SharePoint lists PST files.
    can I import them back into sharepoint somehow?
    No sharepoint admin experience I am afraid:(

    Hi,
    According to your post, my understanding is that you wanted to know how the lists created in the Outlook.
    You can synchronize a SharePoint library, contact list, task list, Project task list and a certain type of SharePoint external list with Microsoft Outlook 2010.
    The SharePoint list.pst files are created when we click the “Connect to Outlook” option in SharePoint list ribbon as below.
    You don’t need to import this files, the files would be synced automatically to the Outlook when you click the option again in the SharePoint.
    You can refer to the following articles to understand the SharePoint works with Outlook.
    http://office.microsoft.com/en-in/outlook-help/open-edit-and-update-files-from-a-sharepoint-site-HA010354947.aspx
    http://office.microsoft.com/en-in/sharepoint-foundation-help/synchronize-sharepoint-2010-content-with-outlook-2010-HA101881295.aspx
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Using powershell to manipulate mapi profile and PST file locations

    I have a situation whereby I need to move a bunch of PST files out of the default location in Office 2010 and change the mapi profile for the user so that the pst file location updated so the user doesn't experience any issues when launching Outlook.
    My logic flow is as follows:
    1.) locate All pst files referenced in the logged on users MAPI profile.
    2.) Move these files to a another directory eg. c:\users\%username%\OutlookFiles
    3.) Update the MAPI profile to point to the new location so that when the user launches Outlook he doesn't notice that the files have been moved.
    I know how to copy the files using powershell etc. but how on earth do you query the MAPI profile to locate the pst files and then change each entry for a PST file to point to the new location.
    Anyone got any ideas?

    What you are trying to do cannot normally be done with a script due to a whole host of reasons including differences in versions and lack of access to a users profile.
    !. Are you on Exchnage?
    2. Have you redirected the users folders with Group Policy yet?
    Outlook OST files are not movable without the use of a third party tool.  It is far easier to just have the users create a new profile.
    PST files that are attached in a user session can be moved using a script that can be run by the user.
    ¯\_(ツ)_/¯

  • Importing PST file using Import-Mailbox Command Crashes Powershell

    I am attempting to import a .pst file into a mailbox via the Import-Mailbox powershell command. The command starts and imports the deleted items and creates the folder structure in the Inbox then crashes powershell. I am running Outlook 2007 SP2 on a Windows 2003 Std SP2 server w/Exchange 2007 SP1 Update Rollup 8 management tools. I have tried everything i can think of. This happens on multiple machines with similar packages installed. No anti-virus software is installed. It happens on both pst files i am testing with and no errors are logged in the event logs either on the exchange mailbox server or the server i am using to do the import.

    Have you tried to do this from the actual Exchange 2007 server?  I assume you are trying to import the pst to an Exchagne 2007 email account to Exchange 2007 correct?
    Have you tried to perform the import on a Windows XP machine using the 32bit EMC/EMS rather then using Windows 2003 server? 
    I honestly recall in the back of my head a problem with Exchange 2007 and Outlook CDOs or something like that.  I could be wrong but I remember something from a year ago.....
    Seriously though, try it from a Windows XP machine running the Exchange Managerment Tools and see what happens rather then a W2K3 Server.
    SF - MCITP:EMA, MCTS
    Yea I double check the link i posted as well I never tried from a 2003 server either, I've always done it from an XP machine, but again we know its works because you got it to work with a newly export PST, so I think its more to do with the PST file itself, hopefully you dont have a bunch of them, if so let the users re-import them =)

  • Add File Attachment to CI using Powershell

    Hi Everyone,
    does sombody have a sample Powershell script of how to add an file attachment to a CI ? Found a few c# samples, but need to use Powershell.
    I want to add Icon files to a CI as File attatchment.
    Thanks

    Hi Sebastian,
    Try this:
    # --- load smlets ---
    $a = (get-module|%{$_.name}) -join " "
    if(!$a.Contains("SMLets")){Import-Module SMLets -ErrorVariable err -Force}
    $managementGroup = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup "localhost"
    $FileAttachmentRel = Get-SCSMRelationshipClass "System.ConfigItemHasFileAttachment"
    $classFA = Get-SCSMClass -name "System.FileAttachment"
    $Folder = "C:\temp\temp2"
    $File = get-childitem $folder | ?{$_.name -like 'test.txt'}
    $CItp = Get-SCSMObjectProjection System.ConfigItem.Projection -filter "DisplayName -eq 'Win7'"
    $filepath = $Folder +"\" + $File.Name
    #------------ Inject attach --------------------------------------------------------------------
    $mode =[System.IO.FileMode]::Open
    $fRead = new-object System.IO.FileStream $filepath, $mode
    $length = $file.length
    $newFileAttach = new-object Microsoft.EnterpriseManagement.Common.CreatableEnterpriseManagementObject($managementGroup, $classFA)
    $newFileAttach.Item($classFA, "Id").Value = [Guid]::NewGuid().ToString()
    $newFileAttach.Item($classFA, "DisplayName").Value = $File.Name
    $newFileAttach.Item($classFA, "Description").Value = $File.Name
    $newFileAttach.Item($classFA, "Extension").Value = $File.Extension
    $newFileAttach.Item($classFA, "Size").Value = $length
    $newFileAttach.Item($classFA, "AddedDate").Value = [DateTime]::Now.ToUniversalTime()
    $newFileAttach.Item($classFA, "Content").Value = $fRead
    $CItp.__base.Add($newFileAttach, $FileAttachmentRel.Target)
    $CItp.__base.Commit()
    $fRead.close()
    Cheers,
    Marat
    Site: www.scutils.com  Twitter:
      LinkedIn:
      Facebook:

  • Report the size of all SharePoint Databases in a text file using PowerShell?

    I am new to Powershell. please help me for following question with step by step process.
    How to report the size of all SharePoint Databases in a text file using PowerShell?

    Hi Paul,
    Here is the changed script, which will also include the size for the Config DB.
    Please let me know if it worked:
    #Get SharePoint Content database sizes
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    $date = Get-Date -Format "dd-MM-yyyy"
    #Variables that you can change to fit your environment
    $TXTFile = "D:\Reports\SPContentDatabase_$date.txt"
    $SMTPServer = "yourmailserver"
    $emailFrom = "[email protected]"
    $emailTo = "[email protected]"
    $subject = "Content & Config Database size reports"
    $emailBody = "Daily/Weekly/Monthly report on Content & Config databases"
    $webapps = Get-SPWebApplication
    $configDB = Get-SPDatabase | ?{$_.Name -eq ((Get-SPFarm).Name)}
    $ConfigDBSize = [Math]::Round(($configDB.disksizerequired/1GB),2)
    Add-Content -Path $TXTFile -Value "Config Database size: $($ConfigDBSize)GB"
    Add-Content -Path $TXTFile -Value ""
    foreach($webapp in $webapps)
    $ContentDatabases = $webapp.ContentDatabases
    Add-Content -Path $TXTFile -Value "Content databases for $($webapp.url)"
    foreach($ContentDatabase in $ContentDatabases)
    $ContentDatabaseSize = [Math]::Round(($ContentDatabase.disksizerequired/1GB),2)
    Add-Content -Path $TXTFile -Value "- $($ContentDatabase.Name): $($ContentDatabaseSize)GB"
    if(!($SMTPServer) -OR !($emailFrom) -OR !($emailTo))
    Write-Host "No e-mail being sent, if you do want to send an e-mail, please enter the values for the following variables: $SMTPServer, $emailFrom and $emailTo."
    else
    Send-MailMessage -SmtpServer $SMTPServer -From $emailFrom -To $emailTo -Subject $subject -Body $emailBody -Attachment $TXTFile
    Nico Martens - MCTS, MCITP
    SharePoint 2010 Infrastructure Consultant / Trainer

  • Uploading document using Powershell is throwing error- There is no file with URL

    Hi.
    I am trying to upload multiple documents to a sub folder in a library using powershell.
    I am getting the error as : ForEach-Object : Exception calling "Add" with "3" argument(s):
    "<nativehr>0x80070003</nativehr><nativestack></nativestack>There is no file
    with URL 'server/TestLibrary/User_image/ab_3f_wht_ist_small_gif.gif' in this Web."
    I have used the below code:
    function UploadImages($weburl)
    $docLibraryName = "TestLibrary"
    $localFolderPath = "C:\Users\Imgs\user_image"
    Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
    $web = Get-SPWeb -Identity $webUrl
    $docLibrary = $web.Lists[$docLibraryName]
    $subFolderName="user_image"
    Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
    $web = Get-SPWeb -Identity $webUrl
    $docLibrary = $web.Lists[$docLibraryName]
    #Attach to local folder and enumerate through all files
    $files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles() | ForEach-Object {
    #Create file stream object from file
    $fileStream = ([System.IO.FileInfo] (Get-Item $_.FullName)).OpenRead()
    $contents = new-object byte[] $fileStream.Length
    $fileStream.Read($contents, 0, [int]$fileStream.Length);
    $fileStream.Close();
    write-host "Copying" $_.Name "to" $docLibrary.Title "in" $web.Title "..."
    #Add file
    $folder = $web.getfolder($docLibrary.Title + "/" + $subFolderName)
    write-host "folder is " $folder
    $spFile = $folder.Files.Add($folder.Url + "/" + $_.Name, $contents, $true)
    $spItem = $spFile.Item
    Write-Host -f Green "Added Images to Library !!!"
    $web.Dispose()
    How to fix this?
    Thanks

    HI,
    Is the name of the image or the sub folder name the issue?
    I have the images with the name as "ab_3f_wht_ist_small_gif.gif".  folder name "User_image"
    There are underscores on the file name, but there is no space. When I add the file from the library (using the UI), the image is getting added.
    But adding through the powershell is giving the issue.
    I have checked this:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e810ad03-81ef-4fa6-aab8-ddc896a13ebf/getting-error-during-uploading-a-document-using-powershell?forum=sharepointdevelopmentprevious
    but did not help.
    Thanks

  • Parse log file using powershell

    Hi,
    Am pretty new to Powershell and would require anyone of your assistance in setting up a script which parse thru a log file and provide me output for my requirements below.
    I would like to parse the Main log file for Barra Aegis application(shown below) using powershell.
    Main log = C:\BARRALIN\barralin.log
    Model specific log = C:\BARRALIN\log\WG*.log
    Requirements :
    1. scroll to the bottom of the log file and look for name called "GL Daily" and see the latest date which in the example log below is "20150203"
    note : Name "GL Daily" and date keep changing in log file
    2. Once entry is found i would like to have a check to see all 3 entries PREPROCESS, TRANSFER, POSTPROCESS are sucess.
    3. If all 3 are success i would like to the script to identify the respective Model specific log number and print it out.
    E.g if you see the sample log below for "GL Daily", it is preceded by number "1718" hence script should append the model log path with "WG00" along with 1718, finally it should look something like this  C:\BARRALIN\log\WG001718.log.
    4. If all 3 items or anyone of them are in "failed" state then print the same log file info with WG001718.log
    Any help on this would be much appreciated.
    Thank You.
    Main log file :
    START BARRALINK            Check Auto Update                                                1716  
    43006  20150203 
        Trgt/Arch c:\barralin                                               
        PREPROCESS           success   0 preprocessor: no error                   
        TRANSFER             success   1 Host success: files received             
        POSTPROCESS          success   0 Postprocessor: no error                  
        CONFIRMATION         success   2 No Confirm needed                        
    STOP  43105  20150203 
    START Aegis                GL Monthly                                                    
      1716   43117  20150203 
        Trgt/Arch K:\barraeqr\aegis\qnt\gleqty                              
        PREPROCESS           success   0 preprocessor: no error                   
        TRANSFER             success   1 Host success: files received             
        POSTPROCESS          success   0 Postprocessor: no error                  
        CONFIRMATION         success   2 No Confirm needed                        
    STOP  44435  20150203
    START Aegis                UB Daily                                                    
      1717   43107  20150203 
        Trgt/Arch K:\barraeqr\aegis\qnt\gleqty                              
        PREPROCESS           success   0 preprocessor: no error                   
        TRANSFER             success   1 Host success: files received             
        POSTPROCESS          success   0 Postprocessor: no error                  
        CONFIRMATION         success   2 No Confirm needed                        
    STOP  44435  20150203 
    START Aegis                GL Daily                                                    
        1718   44437  20150203 
        Trgt/Arch K:\barraeqr\aegis\qnt\gleqty                              
        PREPROCESS           success   0 preprocessor: no error                   
        TRANSFER             success   1 Host success: files received             
        POSTPROCESS          success   0 Postprocessor: no error                  
        CONFIRMATION         success   2 No Confirm needed                        
    STOP  50309  20150203 
     

    Hi All,
    I was writing a function in power shell to send email and i was looking to attach lines as and when required to the body of the email. but am not able to get this done..Here's my code
    Function Email ()
    $MailMessage = New-Object System.Net.Mail.MailMessage
    $SMTPClient = New-Object System.Net.Mail.SmtpClient -ArgumentList "mailhost.xxx.com"
    $Recipient = "[email protected]"
    If ($MessageBody -ne $null)
    $MessageBody = "The details of Barra $strsessionProduct model is listed below
    `rHostName : $localhost
    `r Model Run Date : $Date
    `r Model Data Date : $DateList1
    `r`n Click for full job log"+ "\\"+$localhost+"\E$\Local\Scripts\Logs "
    $MailMessage.Body = $MessageBody
    If ($Subject -ne $null) {
    $MailMessage.Subject = $Subject
    $Sender = "[email protected]"
    $MailMessage.Sender = $Sender
    $MailMessage.From = $Sender
    $MailMessage.to.Add($Recipient)
    If ($AttachmentFile -ne $null) { $MailMessage.Attachments.add($AttachmentFile)}
    $SMTPClient.Send($MailMessage)
    $Subject = "Hello"
    $AttachmentFile = ".\barralin.log"
    $MessageBody = "Add this line to Body of email along with existing"
    Email -Recipient "" -Subject $Subject -MessageBody $MessageBody -AttachmentFile $AttachmentFile
    as you can see before calling Email function i did add some lines to $MessageBody and was expecting that it would print the lines for $MessageBody in Email Function along with the new line. But thats not the case.
    I have tried to make $MessageBody as an Array and then add contents to array
    $MessageBody += "Add this line to Body of email along with existing"
    $MessageBody = $MessageBody | out-string
    Even this didnt work for me. Please suggest me any other means to get this done.
    THank You

  • Is it possible to monitor State change of a .CSV file using powershell scripting ?

    Hi All,
    I just would like to know Is it possible to monitor State change of a .CSV file using powershell scripting ? We have SCOM tool which has that capability but there are some drawbacks in that for which we are not able to utilise that. So i would like
    to know is this possible using powershell.
    So if there is any number above 303 in the .CSV file then i need a email alert / notification for the same.
    Gautam.75801

    Hi Jrv,
    Thank you very much. I modified the above and it worked.
    Import-Csv C:\SCOM_Tasks\GCC2010Capacitymanagement\CapacityMgntData.csv | ?{$_.Mailboxes -gt 303} | Export-csv -path C:\SCOM_Tasks\Mbx_Above303.csv;
    Send-MailMessage -Attachments "C:\SCOM_Tasks\Mbx_Above303.csv" -To “[email protected]" -From “abc@xyz" -SMTPServer [email protected] -Subject “Mailboxex are above 303 in Exchange databases” -Body “Mailboxex are above 303 in Exchange databases" 
    Mailboxex - is the line which i want to monitor if the values there are above 303. And it will extract the lines with all above 303 to another CSV file and 2nd is a mail script to email me the same with the attachment of the 2nd extract.
    Gautam.75801

  • Using PowerShell to auto archive exchange mailboxes to *.pst.

    I am trying to auto-archive terminated users' mailbox to *.pst using PowerShell.  I use the commandlet, New-MailboxExportRequest.  I then type in the the correct file path and mailbox name; however, I keep getting an error indicating that exchange
    could not find a database suitable to store my request.  Can someone please advise as to how I can remedy this error?  

    Hi,
    Please include the full command you ran and the full error text. Also, what version of Exchange are you running?
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • How can I convert an outlook pst file to mac mail without using a windows based computer

    I recently bought the new iMac as my older Windows based computer crashed with a bad motherboard.  I have been trying to find a way to convert Outlook 2007 pst files to Mac Mail without the need to use a Windows based computer since all I have now is a Mac.  I have the copies of the pst files on my Mac, so I am looking for the most efficient way to convert them to the format that I can then open them in the Mac Mail.  Any suggestions would be greatly appreciated.

    Hi - thanks for the instructions but where do you get the option for Quicktime. If I do File - Export I only get the options for File name, place and size but no option that allows to select quicktime:-(
    Have you got any more tips?

  • How to get Document Set property values in a SharePoint library in to a CSV file using Powershell

    Hi,
    How to get Document Set property values in a SharePoint library into a CSV file using Powershell?
    Any help would be greatly appreciated.
    Thank you.
    AA.

    Hi,
    According to your description, my understanding is that you want to you want to get document set property value in a SharePoint library and then export into a CSV file using PowerShell.
    I suggest you can get the document sets properties like the PowerShell Command below:
    [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
    $siteurl="http://sp2013sps/sites/test"
    $listname="Documents"
    $mysite=new-object microsoft.sharepoint.spsite($siteurl)
    $myweb=$mysite.openweb()
    $list=$myweb.lists[$listname]
    foreach($item in $list.items)
    if($item.contenttype.name -eq "Document Set")
    if($item.folder.itemcount -eq 0)
    write-host $item.title
    Then you can use Export-Csv PowerShell Command to export to a CSV file.
    More information:
    Powershell for document sets
    How to export data to CSV in PowerShell?
    Using the Export-Csv Cmdlet
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Search and Replace text in file using PowerShell

    I want to schedule a script in PowerShell to search a directory for an XML file for a particular text string and replace it with a different text string and then save the file with the same name, the name of the file
    will change each time the script is run on a daily basis. There will only be one XML file in the location when the scheduled script is run.
    I have never used PowerShell but am familiar with batch file commands, can anyone please help!!
    KevinS

    Hi Kevin,
    I’m writing to just check in to see if the suggestions were
    helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please
    click here.
    Best Regards,
    Anna
    TechNet Community Support

Maybe you are looking for

  • Reader 10.1.4. Printing PDF by command line

    Hi In an application I have developed I print PDF files to a defined printer using command line, such as "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\acrord32.exe" /N /T "myPDFfile.pdf" "\\servername\printername" I have noticed a change of behavi

  • Imessage in ICloud and Mac OS  10.8?

    Hi. I dont get my I message working via iCloud id? I just got Mac OS 10.8 and iMessage but I dont get it to work with ICloud id. The symptom is that when I try to logg in to my Apple Id it get stuck with nothing that happens. No respond at all. Not a

  • Select tool and Tab randomly stop working

    When filling in a form in Reader, the select tool and Tab between fields feature sometimes stop working at random. Right clicking the field and then left clicking (not on Paste menu) seems to work to allow writing in the field again. Sometimes this a

  • JDBC Thin Drivers and Tom Cat Compatibility Error

    I tried to use thin drivers in JDK 1.4 and Oracle 9i. The Oracle 9i has got a jar file named classes12.jar. i usually compile my .java files with the command: javac -classpath D:\oracle\jdbc\lib\classes12.jar <nameOfFile.java> the same is run in the

  • Problem with System Control Manager on MSI GX660

    HI. I am new I have problem with my MSI GX660. Since yesterday SCM didn't work for me. When windows starts, SCM have appcrash error and FN, and touchpad(eco,turbo,wifi) didn't work. I installed the newest version of SCm but still didn't work. I have