So I have an issue here that I'm not sure if it can even be sorted.
Putting in a new VM provisioning system. Have multiple datacenters & clusters and would like the ability to automate moving a newly created vm to a blue folder. The blue folder structure may have multiple sub folders and those subs may contain the same name as others within the same datacenter. Is it possible or will I only be able to do this if the sub folders are unique within a given datacenter?
For instance--
DC1\Site-A\Folder1\Appx
I'd like to move the VM to the "Appx" folder; however, because of this scenario,
DC1\Site-B\Folder2\Appx
I don't know how to distinguish the two.
Suggestions?
Thanks!
Perhaps the function in my Folder by Path post could help ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Perhaps the function in my Folder by Path post could help ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Perfect. With this I can now do something like the following & she works...
Move-VM -VM SomeVM -Destination (Get-FolderByPath -Path $SomeFullPathStartingAtDC)
Thanks!
Hi Luc,
When I use your function, I get the following error..
***********
Get-Inventory : Cannot validate argument on parameter 'Name'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
***********
Could it be because of $_ being Null??
I am importing a csv file with 2 columns VMName and BlueFolderFullPath.
After your function I am adding this line to get the info from the csv.
foreach ($VM in $ImportCSV)
{
Move-VM -VM $VM.VMName -Destination (Get-FolderByPath -Path $VM.BlueFolderFullPath)
}
Thanks,
Alberto
Could you perhaps show us what you have in the CSV file that you imported into the $ImportCSV variable ?
I suspect one of the BlueFolderFullPath fields might not be correct.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Actually I just found the problem.
When I did the blue folder path export it didn't include the DC name and your function requires the DC name in front of the path.
Thanks for your reply.. Great function...
Alberto-