I experience an odd behaviour on my home laptop when I create functions. The parameters are not passed into a function.
Example:
function Get-Info {
param (
$input
)
$input | gm
}
With this code (Get-Info -input 'test') I receive the errors:
gm : You must specify an object for the Get-Member cmdlet.
At line:5 char:14
+ $input | gm
+ ~~
+ CategoryInfo : CloseError: (:) [Get-Member], InvalidOperationException
+ FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand
I was also just trying to print a verbose statement with the parameter but I only get an empty row.
Why is the parameter not passed into the function?
$inputvariable has a special meaning. ReadGet-Help about_Automatic_Variables.