Export from ProjectWise

Hey All,

Clearly I am new at this so don't laugh but looking for some assistance with export scrip. I have played around and done a basic export with powershell to a local system drive but want to make it a little more sophisticated and resolve a couple of things.

I used the below code simply searching and exporting on a file extension. However I would like to be able to search for any file modified in the last x days, but don't know how to go about it. Tried a few things but have not been successful in achieving what I want.

Additionally when I export  is it possible that the data retains the original "data modified" for PW? At present it simply shows the time exported as "date modified" in Windows.

#Credentials - change to suit
 $Datasource = 'xxx.bentley.com:xxx';
 #Open Connection 
 New-PWLogin -DatasourceName $Datasource -UserName "PWxx" -Password (ConvertTo-SecureString -String xxxxx -AsPlainText -Force) -Verbose
 # Specify the folder to export
 $FoldersToExport =  @("\17053\")
 # Local folder to export documents to.
 $ExportFolder = 'C:\Export'
 Foreach($FolderToExport in $FoldersToExport){
 $LocalExportLocation = 'C:\Export'
 #Set export location
 write-host 'PW Folder: ' $FolderToExport
 write-host 'Local Folder: ' $LocalExportLocation

 # Populate variable with ProjectWise document objects to be exported.
 $pwDocumentsToExport =  Get-PWDocumentsBySearch -FolderPath $FolderToExport -filename '%.txt'
 # Show the number of documents being exported.
 # Show list of document names.
 $pwDocumentsToExport | Select-Object Name
 # Local folder to export documents to.
 $ExportFolder = 'C:\Export'
 # Open the local folder to see content.
 # Explorer $exportFolder
 # Export documents to local folder.
 $Splat_Export = @{
    InputDocuments = $pwDocumentsToExport
    OutputFolder = $LocalExportLocation
 $Results = Export-PWDocuments @Splat_Export -Verbose
 Remove-Variable Datasource
 Remove-Variable FoldersToExport
 Remove-Variable ExportFolder
 Remove-Variable FolderToExport
 Remove-Variable LocalExportLocation

Any help would be appreciated, thanks in advance

Parents Reply Children
No Data