I have a function where a parameter variable declared as a [string]. The problem is I notice that if I feed it numbers with leading zeroes (e.g. 00426) it will trim those zeroes like it was an Int. I thought the point of making it a string is so that it won’t fiddle with input like that? Any way to avoid this? The only way I know to workaround is by wrapping input in quotes:
My-Function -Parameter 0002440, 000953
My-Function -Parameter “0002440”, “000953”.
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)] [ValidateNotNullOrEmpty()] [string]$Device,