I have following PowerShell command see below, but I’m not able to filter for the PW application ‘’AutoCAD Mechanical’’. With this command I get all DWG files, but I need only the DWG files with the PW application ‘’AutoCAD Mechanical’’
Get-PWDocumentsBySearch -FileName "%.dwg" -GetAttributes | Set-PWDocumentApplication -Application "AutoCAD"
Could you not create a Global saved search in ProjectWise called "AutoCAD Mechanical DWG Files" looking for documents with Application type "AutoCAD Mechanical" and filename "%.dwg" then call the command this way:
Get-PWDocumentsBySearch -SearchName "AutoCAD Mechanical DWG Files" | Set-PWDocumentApplication -Application "AutoCAD"
yes Global saved search will work, but many files more than 3'000'000 dwg files. I think powershell will run faster than the user interface from PW or I'm wrong?
In your saved search make sure you add is current version and status is checked in and state is not final.
you can't change the application on versions or files that are checked out (or exported with a lock) or files in final status.
also, you can bulk change the application in Explorer by selecting the files and using the Modify command.
probably. for that many files I'd try an limit it to a certain block at a time. Changing 3,000,000 records in one go may kill the database. I'd still use a global search that Chris mentions (with my add-ons), that's a lot faster than the powershell search.
Do you have and dwg's currently set correctly or is everything wrong? If everything is wrong you could rename the existing AutoCAD application to "AutoCAD - Old" then rename the "AutoCAD Mechanical" to "AutoCAD" and change all the options in the properties to match the what is set in "AutoCAD - old". Then you wouldn't have to change anything.
That won't work if you have files using the existing AutoCAD application, or if you actually need the AutoCAD Mechanical application.
Here's a search example that would only find files created before this year (I don't have an AutoCAD Mechanical application so I used AutoCAD 2019)
You can tweak the file update time 'til you get an acceptable number of test files. If your powershell script uses the global search, it's easy to tweak the search to do a block of files at time without changing the underlying script.