case#1 doesn't work:
85# Get-Folder vm | New-Folder bat
New-Folder : Cannot bind parameter 'Location'. Cannot convert value "bat" to
type "VMware.VimAutomation.Types.VIContainer". Error: "Invalid cast from 'Sys
tem.String' to 'VMware.VimAutomation.Types.VIContainer'."
At line:1 char:27
+ Get-Folder vm | New-Folder <<<< bat
case#2 works:
86# Get-Folder vm | New-Folder -Name bat
Name Id
---- --
bat Folder-group-v478
From help (snipped):
-Location <VIContainer>
Position? 1
-Name <String>
Position? 2
If the position of these two params were reversed, then case #1 and case #2 would both work.
Since "name" is not accepted on the pipeline, you cannot do the reverse (e.g. "folder name" | new-folder -location "vm"), so there's really no reason to have Location be param #1 from what I can tell.
Agree? Disagree?
Hal Rottenberg
Co-Host, PowerScripting Podcast (http://powerscripting.net)
My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker.
I'm @halr9000