Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum ProjectWise-export, download or copy 55 folders each day to my computer
    • Sign In

    • State Suggested Answer
    • Replies 4 replies
    • Answers 1 answer
    • Subscribers 66 subscribers
    • Views 6111 views
    • Users 0 members are here

    ProjectWise-export, download or copy 55 folders each day to my computer

    Mishu Radulescu
    Offline Mishu Radulescu over 6 years ago

    Hi,

    I would like to export, download or copy  55 folders each day to my computer.

    I need to copy 55 specific folders  to my computer each day. I don't know to program in Project Wise.

    Do you know a way (application) to read an address folder list then to Copy(export or download) the folders in my computer?

    Thanks a lot

    • Sign in to reply
    • Cancel

    Top Replies

    • Paul Patterson
      Offline Paul Patterson Fri, Feb 10 2017 8:36 AM +1 suggested
      PowerShell is certainly the answer here.. run the script as a scheduled task.. I usually run them on a separate server, and have them email me any errors when complete. See below.. this should get you…
    • Paul Patterson
      0 Offline Paul Patterson Fri, Feb 10 2017 8:36 AM

      PowerShell is certainly the answer here.. run the script as a scheduled task.. I usually run them on a separate server, and have them email me any errors when complete.

      See below.. this should get you started. You'll obviously want to test this in a test area somewhere.. this pulls out all *.set files from a list of directories in PW, and places them in the same path to your local export directory (c:\export?).. modify as you see fit.

      You probably don't want to store plain text passwords in the ps1 file.. but if you're just running this locally, then I'm sure it's fine. You could also use the -gui switch on open-pwconnection, that would prompt for username/pass or SSO.

      Apologies on the formatting.. it was all lost when pasted into this window.

      Hopefully this helps.

      <#=====================================================================================================+
      | Export Directories (Unmanaged)
      | Written by: Paul Patterson Feb 09 2017
      +=====================================================================================================#>

      #-------------------------------------#
      #Import PW Modules
      #-------------------------------------#

      Import-Module -Name "C:\Program Files (x86)\Bentley\ProjectWise\bin\PowerShell\pwps\PWPS.dll" -Verbose
      Import-Module -Name "C:\Program Files (x86)\Bentley\ProjectWise\bin\PowerShell\PWPS_DAB\PWPS_DAB.dll" -Verbose #min version 20170201a to support copy out function

      #-------------------------------------#
      # PREFERENCES
      #-------------------------------------#

      # Stop this script if there are any errors
      $ErrorActionPreference = 'Stop'
      # Write out all debug and verbose messages
      $DebugPreference = 'Continue'
      $VerbosePreference = 'Continue'

      #Credentials - change to suit
      $Datasource = 'integration_server:DS_Name';
      $username = 'username';
      $password = 'password';

      #-------------------------------------#
      #Do what we need to do
      #-------------------------------------#

      #This is the array for the list of folders to export.
      $FoldersToExport = @("\0-Paul\Export", "\0-Paul\Import")

      #Import from CSV might be a better choice
      # $FoldersToExport = import-csv -Path 'C:\path\to\.csv


      #Open Connection
      Open-PWConnection -DatasourceName $Datasource -UserName $username -Password $password

      Foreach($FolderToExport in $FoldersToExport){
      $LocalExportLocation = 'C:\Export' + $FolderToExport #Set export location
      write-host 'PW Folder: ' $FolderToExport
      write-host 'Local Folder: ' $LocalExportLocation

      Get-PWDocumentsBySearch -FolderPath $FolderToExport -filename '%.set' | CheckOut-PWDocuments -copyout -ExportFolder $LocalExportLocation #Export
      }

      #Close Connection
      Close-PWConnection

      #Cleanup
      Remove-Variable Datasource
      Remove-Variable username
      Remove-Variable password
      Remove-Variable FoldersToExport
      Remove-Variable FolderToExport
      Remove-Variable LocalExportLocation

       

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    • Greg Hruby
      0 Offline Greg Hruby Tue, Oct 24 2017 1:53 PM in reply to Paul Patterson

      What about the reverse process.  Retrieving folders/files from a Windows server location and importing it into a specific Projectwise folder location. This would be a weekly import - over 2-3 years of project life. 

      After an initial import of files, it would be necessary to import updates to existing files  ( assuming overwrite of existing files unless versioning possible) and new folders/files as they were added.

      the top folder of the Windows data ( and all of its children) would nest under single ProjectWise folder.

      S:\Project8480\.... imported to  pw:\\datasource\Documents\Projects\8480

        

      Greg Hruby - State Of MN

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Arturas Zidonis
      0 Offline Arturas Zidonis Wed, Dec 6 2017 5:26 AM in reply to Greg Hruby

      Greg, 

      For reverse process you can use Import-PWDocuments cmdlet. It imports files from disk and creates corresponding folders and documents in ProjectWise. It also allows to create version or overwrite if the file already exists in the directory.

      Use 'get-help Import-PWDocuments -showWindow' command to see all possible parameters. 

      HTH
      Arturas

         
      This is a test

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Matthew Kallerud
      0 Offline Matthew Kallerud Thu, Oct 18 2018 8:47 AM in reply to Paul Patterson

      What about check all files within several PW folders and if they've been updated since the script was run last, copy those files into another single PW folder with an unique appended name (the name needs to be unique to each script run)? And I do not want to copy the files that have not changed.

      This is for drawings for a Bluebeam Set, and bluebeam sets need separate files in order to track drawing revisions (thus the appended name).

      Any help on how I could do this would be appreciated.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies