Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum User Settings, using Splat function
    • Sign In

    • State Verified Answer
    • Replies 9 replies
    • Answers 4 answers
    • Subscribers 66 subscribers
    • Views 1873 views
    • Users 0 members are here

    User Settings, using Splat function

    Stephen Herrick
    Offline Stephen Herrick over 3 years ago

    All,

    I'm looking for some help on using SPLAT, 

    From the code below, i want to change user properties, utilizing SPLAT

    $NewUserSettings = @{

    UI_CanEditVersions=1
    Doc_CanCreateVersion=1
    DocList_ShowAllVersions=1
    NewVer_CanChangeNewVerSettings=1
    NewVer_ApplySourceDocAttributes=0
    NewVer_RemoveTargetDocAttributes=0
    NewVer_ApplyDocNameOfSourceDoc=0
    NewVer_ApplyFileNameOfSourceDoc=0
    NewVer_ShowDefineVerRulesDialog=0
    NewVer_VersionStringFormat=1


    }


    foreach ($User in $Users)
    {

    $ChangeUser = Get-PWUsersByMatch $User.Name
    Update-PWUserSetting -InputUsers $ChangeUser -SettingName $NewUserSettings

    }

    I am receiving the following error...

    .Update-PWUserSetting : Cannot bind parameter 'SettingName'. Cannot create object of type "PWPS_DAB.UserSetting+SettingName". The
    NewVer_RemoveTargetDocAttributes property was not found for the PWPS_DAB.UserSetting+SettingName object. The available property is:
    [value__ <System.Int32>]
    At C:\PowerShell\_A1 User\Set PWUserDocConflict.ps1:46 char:71
    + ... e-PWUserSetting -InputUsers $ChangeUser -SettingName $NewUserSettings
    + ~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Update-PWUserSetting], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PWPS_DAB.UpdatePWUserSetting

    TIA,

    Stephen

    • Sign in to reply
    • Cancel

    Top Replies

    • Dan Williams
      Offline Dan Williams Mon, Jan 27 2020 6:31 PM +1 verified
      Stephen, Update-PWUserSetting only updates one setting at a time, but can do it for multiple users. See if this approach works for you: New-PWLogin $NewUserSettings = @{ UI_CanEditVersions=1…
    • Robert McMillan
      Offline Robert McMillan Mon, Jan 27 2020 10:38 PM in reply to Stephen Herrick +1 verified
      -SettingName Action_DefaultAction
    • Brian Flaherty
      Offline Brian Flaherty Tue, Jan 28 2020 12:32 PM in reply to Dan Williams +1
      Dan, You can use the following as an alternative to using the GetEnumerator. foreach($us in $NewUserSettings.Keys){ Update-PWUserSetting -InputUsers $users -SettingName $us -SettingValue $NewUserSettings…
    • Dan Williams
      +1 Offline Dan Williams Mon, Jan 27 2020 6:31 PM

      Stephen,

      Update-PWUserSetting only updates one setting at a time, but can do it for multiple users.

      See if this approach works for you:

      New-PWLogin
      
      $NewUserSettings = @{
      UI_CanEditVersions=1
      Doc_CanCreateVersion=1
      DocList_ShowAllVersions=1
      NewVer_CanChangeNewVerSettings=1
      NewVer_ApplySourceDocAttributes=0
      NewVer_RemoveTargetDocAttributes=0
      NewVer_ApplyDocNameOfSourceDoc=0
      NewVer_ApplyFileNameOfSourceDoc=0
      NewVer_ShowDefineVerRulesDialog=0
      NewVer_VersionStringFormat=1
      }
      
      $users = Get-PWUsersByMatch 'Bob','Carol'
      
      foreach ($us in $NewUserSettings.GetEnumerator()) {
          Update-PWUserSetting -InputUsers $users -SettingName $($us.Name) $($us.Value)
          }
      
      Undo-PWLogin
      

      Answer Verified By: Stephen Herrick 

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    • Stephen Herrick
      0 Offline Stephen Herrick Mon, Jan 27 2020 7:08 PM in reply to Dan Williams

      Thanks so much Dan that did the trick,

      what is the setting, Under Document Conflicts, Action, Default Action, "Create New Version"

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Robert McMillan
      +1 Offline Robert McMillan Mon, Jan 27 2020 10:38 PM in reply to Stephen Herrick

      -SettingName Action_DefaultAction 

      Answer Verified By: Stephen Herrick 

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Reject Answer
      • Cancel
    • Stephen Herrick
      0 Offline Stephen Herrick Tue, Jan 28 2020 8:45 AM in reply to Dan Williams

      Thank you Dan, that did the trick,

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    • Stephen Herrick
      0 Offline Stephen Herrick Tue, Jan 28 2020 8:46 AM in reply to Robert McMillan

      Thanks Robert,

      • 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