Hello
I wrote a script to create folder with no problem except a mistake and folder are notre create to the right folder I write a script to revert using get-fowler and filtering some folder are not to right place but when I try to remove folder using command like get-folder -id xxxxx | remove-folder -confirm $true I've error about $true
Remove-Folder : Cannot bind parameter 'Folder'. Cannot convert value "True" to type "VMware.VimAutomation.ViCore.Types.V1.Inventory.Folder". Error: "Invalid cast from
'System.Boolean' to 'VMware.VimAutomation.ViCore.Types.V1.Inventory.Folder'."
At C:\Users\xxxxxxx\xxxxxxx\Data\PowercCli\10-1-PSCLI-MoveAppliToApps.ps1:39 char:53
+ Get-Folder -Id $NoExist.id | Remove-Folder -confirm $true
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Folder], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveFolder
If some one have an idea.
rads.
Eric
there is a typo - you have forgotten the colon:
-confirm:$true
Moderator: Thread moved to the PowerCLI area.
Since $true is the default for the Confirm, you can leave it out completely.
When you don't want to see the Confirmation prompt, you use $false (with the colon).
Get-Folder -Id $NoExist.id | Remove-Folder -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference