none
Display OUtlook PST file location on remote machines

    Question

  • Hi everyone,

     

    I am looking for a PS script that will display the location of PST files on a remote machine.  I found a script on the internet that will this give this info but only for location machine:

     

    # Create Outlook object 
    $Outlook = New-Object -ComObject Outlook.Application 
      $stores = $Outlook.Session.Stores 
      $accounts = $outlook.session.accounts 
       
      # Basic information 
      "Current profile has the following configured accounts:" 
      $dn = @{label = "Account Type"; expression={$_.displayname}} 
      $un = @{label = "User Name"; expression = {$_.username}} 
      $sm = @{label = "SMTP Address"; expression = {$_.smtpaddress}} 
      $accounts | Format-Table -AutoSize $dn,$un,$sm 
      # Check number of stores > 0 
      if ($stores.Count -le 0) {"No stores found"; return} 
       
      # Outlook Off-Line folder store 
      $ost = $stores | where{$_.filepath -match ".ost$"} 
      if (!$ost) 
      { 
         "No Outlook Offline Folder store found" 
      } 
      else 
      { 
         "Exchange Offile Folder Store:" 
         $ost | ft filepath -HideTableHeaders 
        } 
       
      # PST Files 
      $pst = $stores | where {$_.filepath -match ".pst$"} 
      if (!$pst) 
        { 
          "No PST files found" 
        } 
      else 
        { 
          "PST Files" 
          $dn = @{label = "Display Name"; expression={$_.displayname}} 
          $fn = @{label = "File Path"; expression={$_.filepath}} 
          $pst | ft $dn,$fn        
        } 
      # End Script

     

    How do I modify it to query remote computers?  Thanks in advance. 

     

    Andy

     

    Wednesday, October 13, 2010 1:37 PM

Answers

  • I don't think you can create remote com objects so you'd need to use invoke-expression -computer abc -scriptblock{..code..} or something like that..

    Wednesday, October 13, 2010 3:01 PM