Using Copy-PWDocumentsBetweenDatasources appears to set the datetime stamp Incorrectly.

using Copy-PWDocumentsBetweenDatasources appears to set the datetime stamp for Create and file update as 8 hours off. Example: source create time = 2/19/2003 5:28:03 PM and the target after the copy process = 2/19/2003 9:28:03 AM.

I did test out with a copy/drag to both sources a file and the timestamp is correct so it is not the server time that is the problem.

is there utc option that is not being account for? PST settings?

  • Any possible work around or will the cmdlet be updated?
     
    Brian Otto
    IT Specialist – JST CAD Support
    Bonneville Power Administration
    (360) 619-6893
     
  • Possibly add a parameter to the cmdlet to allow for date conversion like; -UTC +8  where the paramaeter UTC will take the number after and use to change the date stamps for create and update appropriately?
     
    Brian Otto
    IT Specialist – JST CAD Support
    Bonneville Power Administration
    (360) 619-6893
     
  • Are these datasources in the same or different time zones?  Are they using UTC time?  Is one using UTC time but not the other?

    Thanks,

    Mark Weisman | Bentley Systems

  • Same time zone and on same SQL instance.
    I should say, though, the source records are from earlier version of the design integration that goes back to v8i. Not sure if that makes any difference.
     
     
    Brian Otto
    IT Specialist – JST CAD Support
    Bonneville Power Administration
    (360) 619-6893
     
  • PWPS_DAB 23.0.3.0 has updated the Copy-PWDocumentsBetweenDatasources with a -ConvertToUTC switch. That might fix the issue.

     

    NAME
        Copy-PWDocumentsBetweenDatasources
        
    SYNOPSIS
        Copies documents to a target folder in another datasource.
        
        
    SYNTAX
        Copy-PWDocumentsBetweenDatasources [-InputDocuments] <ProjectWiseDocument[]> [-TargetDatasource] <string> [-TargetFolderPath] <string> 
        [[-IncludeAuditTrail] <SwitchParameter>] [[-ActiveDocumentsOnly] <SwitchParameter>] [[-ConvertToUTC] <SwitchParameter>] [<CommonParameters>]
        
        
    DESCRIPTION
        Takes an array of document objects from the pipeline and copies them to a target folder in another datasource.
        
    
    PARAMETERS
        -InputDocuments <ProjectWiseDocument[]>
            Array of document objects from pipeline (Required).
            
        -TargetDatasource <string>
            Target datasource name (Required).
            
        -TargetFolderPath <string>
            Path to target folder (Required).
            
        -IncludeAuditTrail <SwitchParameter>
            Include Audit Trail.
            
        -ActiveDocumentsOnly <SwitchParameter>
            Active documents only. Filters version documents from input list.
            
        -ConvertToUTC <SwitchParameter>
            Converts timestamps to utc.
            
        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see 
            about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). 
        
        ----------  EXAMPLE 1  ----------
        
        #Get documents and copy them to a target folder in another datasource
        New-PWLogin ServerName:SourceDatasourceName
        $docs = Show-PWDocumentSelectionDialog
        $encryptedPassword = Read-Host -Prompt "Enter Password:" -AsSecureString
        New-PWLogin ServerName:TargetDatasourceName -UserName pwadmin -Password $encryptedPassword
        $folder = Show-PWFolderBrowserDialog
        Set-PWSession ServerName:SourceDatasourceName
        Copy-PWDocumentsBetweenDatasources $docs -TargetDatasource ServerName:TargetDatasourceName -TargetFolderPath $folder.FullPath
        
    REMARKS
        To see the examples, type: "get-help Copy-PWDocumentsBetweenDatasources -examples".
        For more information, type: "get-help Copy-PWDocumentsBetweenDatasources -detailed".
        For technical information, type: "get-help Copy-PWDocumentsBetweenDatasources -full".