Doing up some automation scripts to mass create folders with associated cleanup scripts and wondering if anybody has come up with a quicker way to execute... Similar to LucD's get-vm vs get-view?
PowerCLI C:\temp> measure-command {Remove-Folder "Solutions Design 6" -Confirm:$false}
Days : 0
Hours : 0
Minutes : 0
Seconds : 7
Milliseconds : 228
Ticks : 72287489
TotalDays : 8.36660752314815E-05
TotalHours : 0.00200798580555556
TotalMinutes : 0.120479148333333
TotalSeconds : 7.2287489
TotalMilliseconds : 7228.7489
Try this variation
Get-View -ViewType Folder -Filter @{"Name"="^Solutions Design 7$"} | %{ $_.Destroy_Task() }
The filter uses RegEx expression on the rightside operand, hence the ^ and $ meta-characters.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try this variation
Get-View -ViewType Folder -Filter @{"Name"="^Solutions Design 7$"} | %{ $_.Destroy_Task() }
The filter uses RegEx expression on the rightside operand, hence the ^ and $ meta-characters.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ever so slightly quicker...
Like Wow...
thansk LucD