Can you change this
foreach ($VM in $VMs) {
Move-VM -VM $VM -Destination $Folderchk[$Choice - 1] | Out-Null
}
into this
foreach ($VM in $VMs) {
Write-Host "Moving $VM into folder $($Folderchk[$Choice - 1])"
Move-VM -VM $VM -Destination $Folderchk[$Choice - 1] | Out-Null
}
Perhaps that will shed some light on what is happeing
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I suspect your question is about the last loop where you do the Move-VM ?
What do you want to test in the
if(xy){
statement ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
you are right, this is what i need.
I would like to move VMs into a specific folder.
The foldername may exist several times, but under different folders/subfolders.
If I select Folder123 (DC1\Folder\Folder321\ Folder123), then the VMs should be moved there.
Thanks in advance
any idea...
thanks
Try the attached script
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Unfortunately, it did not work 😞
Any error messages ?
What is displayed on the console ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
no errors.
Can you change this
foreach ($VM in $VMs) {
Move-VM -VM $VM -Destination $Folderchk[$Choice - 1] | Out-Null
}
into this
foreach ($VM in $VMs) {
Write-Host "Moving $VM into folder $($Folderchk[$Choice - 1])"
Move-VM -VM $VM -Destination $Folderchk[$Choice - 1] | Out-Null
}
Perhaps that will shed some light on what is happeing
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks a lot.
You are great
the error was found:
foreach ($VM in $VMs) {
Write-Host "Moving $VM into folder $($Folderchk[$Choice - 1])"
Move-VM -VM $VM.VMName -Destination $Folderchk[$Choice - 1] | Out-Null
}
When you ask for the location of the folder, is that the folder in vCenter? Also, not sure where to specify the csv file that you are wanting to upload, and what the format should be.