If you maintain a large number of Client Settings profiles in your ConfigMgr environment, it can get annoying when you need to create new profiles and shift them high up in the priority list. A good example of this is creating a new profile to test a settings change on a subset of clients and it needs to be above the profile it is overriding. For example, I just added two new profiles in my lab for testing:
1
2
3
4
5
6
7
8
9
10
11
| PS CAS:\> Get-CMClientSetting | Select-Object -Property Name,Priority | Sort-Object -Property Priority | Format-Table -AutoSize
Name Priority
---- --------
Site Settings - PSA 1
Site Settings - PSB 2
Default Settings - Server 3
Default Settings - Workstation 4
Test Settings - Server 5
Test Settings - Workstation 6
Default Client Agent Settings 10000
|
I need the two new profiles that are currently set to 5 and 6 to be moved to 1 and 2. Doing this in the console can get really annoying, as you can’t set the priority directly; instead, you need to select the profile, click “Increase Priority” or “Decrease Priority” in the ribbon, and repeat. Who has time for that?
Instead, let’s move to our best friend PowerShell!
1
2
| PS CAS:\> Set-CMClientSetting -Name 'Test Settings - Server' -Priority 1
WARNING: The cmdlet 'Set-CMClientSetting' has been deprecated and may be removed in a future release. The cmdlet 'Set-CMClientSettingGeneral' may be used as a replacement.
|
OK, that’s fine, we should use the newer cmdlet, but let’s check what happened:
1
2
3
4
5
6
7
8
9
10
11
| PS CAS:\> Get-CMClientSetting | Select-Object -Property Name,Priority | Sort-Object -Property Priority | Format-Table -AutoSize
Name Priority
---- --------
Site Settings - PSA 1
Site Settings - PSB 2
Default Settings - Server 3
Default Settings - Workstation 4
Test Settings - Workstation 5
Test Settings - Server 6
Default Client Agent Settings 10000
|
Huh, the priority for Test Settings - Server
changed from 5 to 6. What happened? Well, if you go back and tab-complete the options for the Priority
parameter, you’ll find that the available options are actually Increase
and Decrease
. Entering 1
was converted to the second possible value of Decrease
. If I go back and run the same command, but using 0
this time, it will revert to priority 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
| PS CAS:\> Set-CMClientSetting -Name 'Test Settings - Server' -Priority 0
WARNING: The cmdlet 'Set-CMClientSetting' has been deprecated and may be removed in a future release. The cmdlet 'Set-CMClientSettingGeneral' may be used as a replacement.
PS CAS:\> Get-CMClientSetting | Select-Object -Property Name,Priority | Sort-Object -Property Priority | Format-Table -AutoSize
Name Priority
---- --------
Site Settings - PSA 1
Site Settings - PSB 2
Default Settings - Server 3
Default Settings - Workstation 4
Test Settings - Server 5
Test Settings - Workstation 6
Default Client Agent Settings 10000
|
Well that’s mildly inconvenient. Let’s look at that newer cmdlet:
1
2
3
4
5
6
7
8
9
10
11
12
13
| PS CAS:\> Set-CMClientSettingGeneral -Name 'Test Settings - Server' -PriorityValue 1
PS CAS:\> Set-CMClientSettingGeneral -Name 'Test Settings - Workstation' -PriorityValue 2
PS CAS:\> Get-CMClientSetting | Select-Object -Property Name,Priority | Sort-Object -Property Priority | Format-Table -AutoSize
Name Priority
---- --------
Test Settings - Server 1
Test Settings - Workstation 2
Site Settings - PSA 3
Site Settings - PSB 4
Default Settings - Server 5
Default Settings - Workstation 6
Default Client Agent Settings 10000
|
Awesome! Set-CMClientSettingGeneral
has a parameter named PriorityValue
that accepts a number and shifts the rest of the profiles down! Interestingly, I only discovered this parameter via trial and error; it is not listed in the cmdlet documentation.
I have created an issue on GitHub mentioning this, so hopefully that gets updated. Until then, I hope this post helps!