Powershell: A parameter cannot be found that matches
New-Object : A parameter cannot be found that matches parameter name 'TypeNamePSObject'
It's not ambiguous at all, the error indicates –TypeNamePSObject
is not a known parameter of the New-Object
cmdlet.
$object = New-Object –TypeNamePSObject
Should be instead:
$object = New-Object –TypeName PSObject
Note the space delimiting the parameter -TypeName
and the value PSObject
.
You may use tab completion to discover parameters. In the console, type a cmdlet's name, a space, -, then Tab to cycle through the known parameters. Shift + Tab will reverse the order.