Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum How do you change a document's Application Association in Powershell?
    • Sign In

    • State Not Answered
    • Replies 2 replies
    • Subscribers 67 subscribers
    • Views 583 views
    • Users 0 members are here

    How do you change a document's Application Association in Powershell?

    Robert Biggar
    Offline Robert Biggar over 2 years ago

    I am trying to find a way to change the application a document is associated with (for viewing, opening, etc.) via PowerShell. I have not been successful in finding anything...hopefully, I am just missing it.  

    Thank You!

    Bob

    • Sign in to reply
    • Cancel
    Parents
    • Kevin van Haaren
      0 Offline Kevin van Haaren Wed, Jan 27 2021 9:33 AM

      Update-PWDocumentProperties can do it, but it's a bit convoluted.

      first build a list of documents that you want, and be sure to do a -getattributes with it

      $doclist = Get-PWDocumentsBySearch -FolderPath 'path\to\files' -Filename '%.pdf' -getattributes

      Next update the ApplicationID on each document (don't update the ApplicationName!) you can get a list of application IDs with get-pwapplications

      foreach ($doc in $doclist) { $doc.ApplicationID = new_id }

      Then update the set of documents

      Update-PWDocumentProperties -InputDocument $doclist

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Robert Biggar
      0 Offline Robert Biggar Wed, Jan 27 2021 10:24 AM in reply to Kevin van Haaren

      Thanks Kevin! (for the "secret handshake: ;-)  ) I will post back what I come up with...

      Bob

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Reply
    • Robert Biggar
      0 Offline Robert Biggar Wed, Jan 27 2021 10:24 AM in reply to Kevin van Haaren

      Thanks Kevin! (for the "secret handshake: ;-)  ) I will post back what I come up with...

      Bob

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Children
    No Data

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies