Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Update-PWRichProjectProperties
    • Sign In

    • State Suggested Answer
    • +1 person also asked this people also asked this
    • Replies 18 replies
    • Answers 5 answers
    • Subscribers 68 subscribers
    • Views 2670 views
    • Users 0 members are here

    Update-PWRichProjectProperties

    Matthew Saxon
    Offline Matthew Saxon over 3 years ago

    My attempt to alter the work area properties of a single work area in a folder with multiple work areas has resulted in them all being changed to the new values. Can anyone see what I have done wrong?

    It is of the form:

    Get-PWRichProjects -FolderPath ‘root work area\secondary work area\folder\tertiary work area’ | Update-PWRichProjectProperties -ProjectProperties @{PROJECT_field1="xxxx"; PROJECT_field2="yyyy"; PROJECT_field3="zzzz"}

    And here is my exact script based our actual folder names, locations and project field names:

    Get-PWRichProjects -FolderPath 'Multicom Resources Pty Ltd\4480 - St Elmo Vanadium\50 - Procurement Contractual Commercial\CP1-003 - Building - Laboratory' | Update-PWRichProjectProperties -ProjectProperties @{PROJECT_Package="CP1-003"; PROJECT_Package_Name="Building - Laboratory"; PROJECT_ProjectNo="4480"}

    • Sign in to reply
    • Cancel
    • Brian Flaherty
      0 Offline Brian Flaherty Tue, Mar 10 2020 1:06 PM

      Include the -JustOne switch parameter when running the Get-PWRichProjects cmdlet.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Dan Williams
      0 Offline Dan Williams Tue, Mar 10 2020 1:07 PM

      Well, as the help says, Get-PWRichProjects will return all the rich projects, either in the datasource, or all of them found in the path specified by -FolderPath UNLESS you use the -JustOne switch parameter.

      It is always easy to read more into what things mean than what they really are.  I'm sure that you aren't the first to "discover" that -FolderPath really means something more like "StartingFolderPath" rather than "JustThisFolderFoundHere".  You have to keep reading the help to "discover" (a key feature of the art of PowerShell) that there's another parameter to change the meaning of -FolderPath to mean "just this specific folder".

      I think your script will work as you intended if you just add -JustOne to Get_PWRichProjects.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Tue, Mar 10 2020 5:02 PM in reply to Dan Williams

      I know it's way too late now, but I wish the default had been to return one folder and to use something like -IncludeSubFolders to recurse down.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Matthew Saxon
      0 Offline Matthew Saxon Wed, Mar 11 2020 3:31 AM in reply to Dan Williams

      As it transpired I had already changed a parameter on every single work area in our datasource running my script!

      I tried running the script with the -JustOne parameter added (on the test datasource this time!) and it worked and it only changed the sub work areas in the location I specified as desired.

      (specifically: Get-PWRichProjects -FolderPath ‘BSI300 - Medical Complex-Córdoba\Test properties 1\Test properties 3\Procurement’ -JustOne | Update-PWRichProjectProperties -ProjectProperties @{PROJECT_Package=""; PROJECT_Package_Name=""; PROJECT_ProjectNo="5002"} )

      When I substituted the desired path into exactly the same script and ran it on the production datasource it started changing the attributes on every work area again. Any ideas?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Dan Williams
      0 Offline Dan Williams Wed, Mar 11 2020 2:12 PM in reply to Matthew Saxon

      Please post your entire script otherwise we can only guess about how that happened.  Also, it is ALWAYS helpful if you include details about your "environment", i.e. version of ProjectWise (Client and Server), version of PWPS_DAB, version of PowerShell, OS, and anything else specific to your situation. 

      Also, your test datasource might be different enough from your production environment that there's something else that is having an impact.  Screen shots of the two showing the "target" work area's path would be helpful as well.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    >

    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