I think $Path in this part of the validation script:
if (![System.IO.Path]::GetExtension($Path).ToLower().Equals(‘.lnk’) -and ![System.IO.Path]::GetExtension($Path).ToLower().Equals(‘.url’))
should be $_
if (![System.IO.Path]::GetExtension($_).ToLower().Equals(‘.lnk’) -and ![System.IO.Path]::GetExtension($_).ToLower().Equals(‘.url’))
I was getting an error saying that $Path was not defined or something (forgot to copy the error) even when trying the New-ADTShortcut example provided in the docs. I changed $Path to $_, imported the module again and the New-ADTShortcut example worked as expected.
In case it matters, I’m working in a Windows 11 sandbox.
I’ve not done much with parameter validation so let me know if I’m not interpreting this correctly. Or if I should be logging this somewhere else.