I am trying to move VMs to a folder but getting this error. any idea?
See duplicate post here.
The reason of the error is as Chip gave, but you can easily script a check to avoid this error.
The Type property tells you what a folder can be used for
Get-Folder | Select Name,Type
And in your scripts you can build in a test, something like this for example
$tgtFolder = 'MyFolder'
$folder = Get-Folder -Name $tgtFolder
if($folder.Type -ne 'VM'){
Write-Output "You can't move VMs in here!"
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference