Be sure to check out my Scripting4Crypto initiative. It’s a fun way to get into using cryptocurrencies all while getting your PowerShell needs met.
Occasionally, within a ProjectWise datasource, files can go missing on a server (file storage area) or files are not deleted properly from a dms folder on a server causing an error when attempting to delete a ProjectWise folder.
With the release of PWPS_DAB module version 184.108.40.206, we have improved the existing Get-PWStorageAreaReport cmdlet to allow for skipping certain tasks to expedite the reporting process. We also have a new cmdlet, Get-PWMissingStorageAreaFiles, which scans a project or an entire datasource and reports on any missing files.
NOTE: You will need to have access to the file storage area(s) in order to run either of these cmdlets. If you do not, you may receive incorrect data.
First things first. Take a look at the help for the Get-PWStorageAreaReport and Get-PWMissingStorageAreaFiles cmdlets to familiarize yourself with the available parameters, etc.
Get-Help Get-PWStorageAreaReport -Full Get-Help Get-PWMissingStorageAreaFiles -Full
The Get-PWStorageAreaReport cmdlet generates a report listing only the discrepancies found within the folder path, storage area, or entire datasource depending on the parameters supplied. We have added two new parameters which allow for certain time consuming tasks to be skipped, thus helping to expedite the processing. Both are switch parameters, so when included the corresponding task will be skipped.
- When included, skips the file size check.
- When included, skips the check for orphaned files.
The following are a couple examples on using the Get-PWStorageAreaReport cmdlet with the new switch parameters.
#The following will create a storage area report for an entire datasource. Skipping the file size check. Get-PWStorageAreaReport -OutputFolder 'D:\Reports' -SkipFileSizeCheck -Verbose #The following will create a storage area report for an entire datasource. Skipping the orphaned file check. Get-PWStorageAreaReport -OutputFolder 'D:\Reports' -SkipOrphanCheck -Verbose
The following table is an example of the report output.
The Get-PWMissingStorageAreaFiles cmdlet returns an array of ProjectWise document objects for any discrepancies found within the folder path supplied or the entire datasource. This cmdlet does not have any required parameters, but does have two optional parameters we will take a look at.
- The folder path of a ProjectWise folder to report on.
- When UseAdminPaths in included, the UNC path to the files will be used.
- Use this option when running this cmdlet remotely.
<# The following will return ProjectWise document objects for any discrepancies found within the entire datasource. #> $MissingDocs = Get-PWMissingStorageAreaFiles -UseAdminPaths -Verbose <# The following will return ProjectWise document objects for any discrepancies found within the specified project. #> $MissingDocs = Get-PWMissingStorageAreaFiles -FolderPath 'Projects\123456 - MyNewProject\' -UseAdminPaths -Verbose
The following is a sample output for this cmdlet. Notice the $MissingDocs variable contains an array of 6 ProjectWise document objects.
Experiment with it and have fun.
Hopefully, you find this useful. Please let me know if you have any questions or comments.
6 thoughts on “How To: Report on Missing Files Within ProjectWise Using PowerShell”
I seem to be getting false positives when it comes to files in the storage area with versions. For example, files in ver00000 folders will show as orphaned when they are not.
I believe this has been resolved in a later build of the PWPS_DAB module.
Question regarding Orphan and Missing files..
I have begun using these cmdlets to assist in validating ProjectWise archiving and have a general question about the cause of Orphan and Missing files in ProjectWise. Generally speaking, is a poor or disrupted network connection the cause of this? I could not find an audit trail explanation. Is this a common issue with ProjectWise and is there a best practice in monitoring this problem. I hate to find out about this at the time of archive since it may be difficult to locate the missing files.
Thanks in advance..
First, thanks for taking the time to checkout my blog. Much appreciated. Hope you find it useful.
As for your question, I am not sure of the exact cause for the orphaned files. It is my opinion that the file transfer is getting interrupted for some reason or other and ProjectWise is not catching it. Could be a disrupted network connection, issue on a server, etc. Have you looked in the event viewer on the PWDI server?
I think running a report to determine if you have any orphaned files is the best approach. You could create a scheduled task to accomplish this on a daily, weekly, monthly, etc. basis.
I have tried to use this script, but I keep getting errors about “\\folderpath\” not found, but the folder path is on the server. Another time I got an error about the user account doesn’t have rights to the folders. However, I am an admin on the server, and in PW? What can I do to make this work?
Hey Kirk, I am not sure what the issue is without looking at it. I would suggest posting this issue on the Bentley Communities and see if someone there can assist. If you continue to have issues let me know and we can try to get together to sort it out. Cheers, Brian