Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum PowerShell Script stopped working
    • Sign In

    • State Not Answered
    • Replies 6 replies
    • Subscribers 66 subscribers
    • Views 1208 views
    • Users 0 members are here
    • powershell
    • PWPowerShell
    • pwps_dab
    • SIG

    PowerShell Script stopped working

    Jason - TRC
    Offline Jason - TRC over 4 years ago

    Been using this script for at least a year in a regular basis and now will not work. Can't seem to figure out why. All the variables are populating so I’m stumped

     

    New-PWLogin @PWLogin -Verbose

    $TargetFolder = '3 - Standards and Quality (QA QC)\Quality (QA QC)\DEG QC Error Tracking\Report Data'

    $SearchName = 'DEG_Powershell'

    $State = 'QA/QC Archived'

    Copy-PWDocumentsBySearch -SearchName $SearchName -FolderPath $TargetFolder -Verbose

    Get-PWDocumentsBySearch -SearchName $SearchName |

    Set-PWDocumentState -State $State -Verbose

    # Log out of ProjectWise

    Undo-PWLogin

     

    This is the error:

    PS C:\Users\pwadmin> Get-PWDocumentsBySearch -SearchName $SearchName |

    An empty pipe element is not allowed.

    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException

    + FullyQualifiedErrorId : EmptyPipeElement

    • Sign in to reply
    • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Wed, Oct 2 2019 3:28 PM

      is there a reason for the | at the end of the line? That's the pipe it's referrring to and with nothing after it, that's an empty pipe. Possible that a line return added after it and it should be:

      Get-PWDocumentsBySearch -SearchName $SearchName | Set-PWDocumentState -State $State -Verbose

      all on one line?

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Brian Flaherty
      0 Offline Brian Flaherty Wed, Oct 2 2019 4:21 PM

      The error seems to indicate that the search is not returning any document objects.  Verify the saved search is returning what you expect.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Bill Graefe
      0 Offline Bill Graefe Thu, Oct 3 2019 3:16 PM in reply to Kevin van Haaren

      That's one of the "hacks" to do a line continuation in PS. If the interpreter sees an char at the end that implies more is expected, it will attempt with the next line. It's also used in formatting. IIRC, it must be the last char. Of course, it never hurts to remove that to ensure. The other demigod Brian probably has the answer below.

      Bill

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Jason - TRC
      0 Offline Jason - TRC Tue, Oct 8 2019 11:11 AM in reply to Brian Flaherty

      verified that the search is returning files, still getting the same error

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Jason - TRC
      0 Offline Jason - TRC Tue, Oct 8 2019 11:11 AM in reply to Kevin van Haaren

      thanks for the suggestion, tried this and still getting the same error

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify 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