Set-PWUserSetting vs Update-PWUserSetting

I am on a quest to eliminate all usage of pwps in favor of pwps_dab in my scripts, so that 
a) I can execute on machines that don't have PW Administrator installed

and

b) I can run all of my powershell scripts in 64-bit mode.  

My latest effort is with Set-PWUserSetting.  We have an automated user-creation routine that sets all of the user settings from a CSV file using the -ValueObjects parameter.  There doesn't seem to be a corresponding parameter for Update-PWUserSetting.  Can someone please enlighten me as to how this could be accomplished (without using pwps, that is)?  Thank you.


Jon

Parents
  • May require a few more lines of code, but the following should get you started.

    # Generate a user settings report.
    $PWUser = 'psUser1'
    $OutputFile = 'd:\temp\UserSettings.xlsx'
    Get-PWUserSettingByUser -InputUsers (Get-PWUsersByMatch -UserName $PWUser) |
    ConvertTo-DataTable | 
    New-XLSXWorkbook -OutputFileName $OutputFile -Open
    
    # Import report (spreadsheet) after updates have been made into a datatable.
    $dts = Get-TablesFromXLSXWorkbook -InputFileName $OutputFile -Verbose
    
    # Loop through each row in the datatable to update the settings.
    foreach($row in $dts[0].Rows){
        $Splat_UserSetting = @{
            InputUsers = Get-PWUsersByMatch -UserName $row.UserName
            SettingName = $row.UserSettingName
            SettingValue = $row.UserSettingValue
        }
        $results = Update-PWUserSetting @Splat_UserSetting
    }

Reply
  • May require a few more lines of code, but the following should get you started.

    # Generate a user settings report.
    $PWUser = 'psUser1'
    $OutputFile = 'd:\temp\UserSettings.xlsx'
    Get-PWUserSettingByUser -InputUsers (Get-PWUsersByMatch -UserName $PWUser) |
    ConvertTo-DataTable | 
    New-XLSXWorkbook -OutputFileName $OutputFile -Open
    
    # Import report (spreadsheet) after updates have been made into a datatable.
    $dts = Get-TablesFromXLSXWorkbook -InputFileName $OutputFile -Verbose
    
    # Loop through each row in the datatable to update the settings.
    foreach($row in $dts[0].Rows){
        $Splat_UserSetting = @{
            InputUsers = Get-PWUsersByMatch -UserName $row.UserName
            SettingName = $row.UserSettingName
            SettingValue = $row.UserSettingValue
        }
        $results = Update-PWUserSetting @Splat_UserSetting
    }

Children