Robert/LucD,
Thanks for your responses. I am feeling a little stupid as you are correct, it is pulling the right number, the problem was with the way I was verifying the number of VMs it was coming back with was no correct. I was looking in vCenter and clicking the top level folder (CompanyX) and counting the number of VMs displayed in the right window pane, assuming these were the VMs in the CompanyX folder, when, in fact, that is the recursive view and shows all VMs in the tree below. There aren't actually any VMs in the top level folder, if there were, they'd be displayed on the left window pane in vCenter, under the folder structure. So, just me not understanding the views and looking closely enough at the actual list of VMs being brought back. Sorry about that.
On side note, the command that Robert provided:
Get-Folder 'CompanyX' | Get-VM | Select-Object -Property Name,Folder
Returns the VM name, but the folder column is empty for some reason. Also, if I run:
Get-Folder 'Company X' -NoRecursion | Get-VM
I get an error:
Get-Folder : 6/27/2011 9:17:50 AM Get-Folder Folder with name 'Company X' not found, using the specified filter(s).
At line:1 char:11
+ Get-Folder <<<< 'Company X' -NoRecursion | Get-VM
I moved a VM directly into the 'Company X' folder and got the same results.
Not a big deal, just curious as to why they don't work.
Thanks for both of your help!
Bob