MSEndpointMgr / IntuneWin32App

Provides a set of functions to manage all aspects of Win32 apps in Microsoft Intune.
MIT License
351 stars 91 forks source link

Fix: ValidateRange works not as intended because the values are strings #142

Closed ThomasSteendijk closed 8 months ago

ThomasSteendijk commented 9 months ago

Change:

Fixed all instances where ValidateRange("$number","$number") is instead of ValidateRange($number,$number)

Issue:

There is an error in the notation of the validation range, which is causing issues when inputting values within that specified range.

Example:

PS C:\Users\thoma> Add-IntuneWin32AppAssignmentGroup -EnableRestartGracePeriod $true -RestartGracePeriod 340
Add-IntuneWin32AppAssignmentGroup : Cannot validate argument on parameter 'RestartGracePeriod'. The 340 argument is greater than the maximum allowed range of 20160. 
Supply an argument that is less than or equal to 20160 and then try the command again.
At line:1 char:87
+ ... signmentGroup -EnableRestartGracePeriod $true -RestartGracePeriod 340
+                                                                       ~~~
    + CategoryInfo          : InvalidData: (:) [Add-IntuneWin32AppAssignmentGroup], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Add-IntuneWin32AppAssignmentGroup

For example RestartGracePeriod 340. 340 is a valid input because 1<340<20160 But because the ValidateRange is incorrect powershell rejects it with the error that 340 (number) is bigger then 20160 (string)

NickolajA commented 8 months ago

What a newb mistake, merging this. Thanks!