Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Update-PWUser error message
    • Sign In

    • State Not Answered
    • Replies 4 replies
    • Subscribers 65 subscribers
    • Views 661 views
    • Users 0 members are here
    • powershell
    • ProjectWise
    • ProjectWise PowerShell Modules

    Update-PWUser error message

    Ben Davies
    Offline Ben Davies over 3 years ago

    Hello, I am trying to change users emails and identities from one domain to another but when testing this I get an error message saying the below, which seems to contradict itself. What am I doing wrong?

    Script:

        #get all user accounts with BAM email
        $bamusers = Get-PWUsersByMatch -Email '*@bamnuttall.co.uk'
       
        foreach($user in $bamusers)
        {
            write-host 'updateing ->' $user.email -ForegroundColor green
            #find replace template number with group
            $user.email = $user.email -replace ($olddomain, $newdomain)
            $user.Identity = $user.email
            Update-PWUser -User $user
        }

    Error:

    Update-PWUser : Cannot bind parameter 'User'. Cannot convert the "Bentley.ProjectWise.PowerShell.Common.User" value of type "Bentley.ProjectWise.PowerShell.Common.User" to type
    "Bentley.ProjectWise.PowerShell.Common.User".
    At line:49 char:29
    +         Update-PWUser -User $user
    +                             ~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Update-PWUser], ParameterBindingException
        + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Bentley.ProjectWise.PowerShell.Commands.UpdatePWUser

    • Sign in to reply
    • Cancel
    Parents
    • Brian Flaherty
      0 Offline Brian Flaherty Wed, Aug 26 2020 8:37 AM

      You cannot mix and match between PWPS and PWPS_DAB module. That is the reason for the error.

      Take a look at the Update-PWUserProperties and Set-PWUserIdentity cmdlets.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Ben Davies
      0 Offline Ben Davies Wed, Aug 26 2020 9:10 AM in reply to Brian Flaherty

      Thanks but is the set-pwuseridentity a new cmdlet as my pwershell says it does not exist?

      Set-PWUserIdentity : The term 'Set-PWUserIdentity' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
      verify that the path is correct and try again.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Reply
    • Ben Davies
      0 Offline Ben Davies Wed, Aug 26 2020 9:10 AM in reply to Brian Flaherty

      Thanks but is the set-pwuseridentity a new cmdlet as my pwershell says it does not exist?

      Set-PWUserIdentity : The term 'Set-PWUserIdentity' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
      verify that the path is correct and try again.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Children
    • Brian Flaherty
      0 Offline Brian Flaherty Wed, Aug 26 2020 10:12 AM in reply to Ben Davies

      Which version of the PWPS_DAB module do you have installed?  I would suggest upgrading to the latest.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Ben Davies
      0 Offline Ben Davies Wed, Aug 26 2020 10:44 AM in reply to Brian Flaherty

      Okay I will give this a go

      • 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