I must be doing something wrong. Hopefully someone can help. When I try to pass the -computername parameter for Get-HotFix it only returns the local machine, but works when I use it in paranthesis for the parameter. BTW, this is from a Month of Lunches Lab (chapter 9). According to the help for Get-Hotfix, the computername parameter should work as pipeline input by PropertyName.
get-adcomputer -filter * | select @{n='computername';e={$_.name}} | Get-HotFix
#This only returns objects for the domain controller (local machine)
Get-HotFix -ComputerName (select -ExpandProperty name)
#This works and returns objects for all the computers on the domain
I’m kinda new to PowerShell but in line one if you are passing a variable “computername” it should have a $ in front and also in double quotes “” instead of single quotes to allow it to use what is stored.
-ComputerName parameter in Get-HotFix takes value from pipeline only in documentation, Actually it doesn’t.
It just iterates through the list of computers specified to ComputerName.
The parameter is just defined like ValueFromPipelineByPropertyName = true
yourself can check it from the source code here. It doesn’t even have a ProcessRecord() method.