Inspect the
property on your PSCmdlet instance.
Question
Please excuse me if you find this a very lame questions, but since I am learning Powershell I need to ask.
This is a sort of next part of the question posted and answer received here.
I have a custom cmdlet named Get-DirectoryListing and I added an alias 'gdl' (using New-Alias command in .psm1 file). So user can use either Get-DirectoryListing or gdl to fire the same command. Now I want to detect in my code (.NET, C#) which text was used to execute the command. Lets say if user used alias 'gdl' to execute the command, I want to show message like
'This alias is deprecated and shouldn't be used.'
But I do not want to show this message if user uses Get-DirectoryListing to execute the command.
What is the best way to achieve this?
La solution