07-21-2023, 12:36 PM
I want to do some basic validation on a user input in PowerShell to ensure a user can only enter a whole integer and does not enter -7 for example. I am not sure how this is done and would appreciate a pointer.
[parameter(Mandatory=$false)][int]$number
If a user enters `-$number` this will be accepted. I want it to reject this type of input.
[parameter(Mandatory=$false)][int]$number
If a user enters `-$number` this will be accepted. I want it to reject this type of input.