Updated Set-DrmmDeviceUdf for support of all udf values#54
Open
CasperStekelenburg wants to merge 1 commit into
Open
Updated Set-DrmmDeviceUdf for support of all udf values#54CasperStekelenburg wants to merge 1 commit into
CasperStekelenburg wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Set-DrmmDeviceUdf to support Datto RMM’s expanded Device UDF range (up to udf300) by moving from individually declared UDF parameters to a key/value input model with validation.
Changes:
- Reworks the cmdlet interface to accept UDF updates via
-UdfData(hashtable/object) rather than-udf1..-udf30. - Adds validation for UDF key format/range and converts empty-string values to
nullin the API payload. - Adds
SupportsShouldProcess/WhatIfsupport and updates help text/examples.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| foreach ($Entry in $UdfEnumerator) { | ||
| $Key = [string]$Entry.Name |
Comment on lines
+29
to
+31
| [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] | ||
| [OutputType([psobject])] | ||
| param( |
| return New-ApiRequest -apiMethod $ApiMethod -apiRequest "/v2/device/$DeviceUid/udf" -apiRequestBody $Body | ||
| } | ||
| } catch { | ||
| Write-Error $_ |
Comment on lines
+31
to
+39
| param( | ||
| [Parameter(Mandatory = $true, HelpMessage = "Provide device uid which will be used to set UDF(s)")] | ||
| [ValidateNotNullOrEmpty()] | ||
| [string]$DeviceUid, | ||
|
|
||
| [Parameter(Mandatory = $false, HelpMessage = "Provide UDF key/value pairs, for example @{ udf1 = 'Value'; udf300 = '' }")] | ||
| [ValidateNotNull()] | ||
| [object]$UdfData | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Datto has updated the number of UDF's to 300, so I updated the function to reflect that.