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

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.

Thanks a lot

Parents
• 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