How to refer a resource pool on a vmware host in PowerCLI command

I am working on moving about 40 vms from one host to another one. There is a resource pool named "desktops" on both vmware host.

I can use this command to move the vm from one host to another. But I don't know how to move the vm to the resource pool on the destination host.

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-VM -Name LACT243 | Move-VM -Destination ca-vmhost11.lacare.org -RunAsync

Name                           State      % Complete Start Time   Finish Time
----                           -----      ---------- ----------   -----------
RelocateVM_Task                Running             0 02:14:47 PM


PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>




Is there a way I can designate the resource pool on a host on PowerCLI 6.0.  like ca-vmhost11.lacare.org:resourcepoolname?

I am new to powerCLI, please advise, thank you.
Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason YuAuthor Commented:
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-VM -Name LACT243 | Move-VM -Destination ca-vmhost11.lacare.org -RunAsync

Name                           State      % Complete Start Time   Finish Time
----                           -----      ---------- ----------   -----------
RelocateVM_Task                Running             0 02:14:47 PM


PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-VM -Name LACT246 | Move-VM -Destination Desktops
Move-VM : 4/1/2015 2:21:56 PM    Move-VM        The specified parameter 'Destination' expects a single value, but your name criteria 'Desktops' corresponds to multiple values.
At line:1 char:24
+ Get-VM -Name LACT246 | Move-VM -Destination Desktops
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (System.Collecti...dObjectInterop]:List`1) [Move-VM], VimException
    + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_MoreResultsThanExpected,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

Move-VM : 4/1/2015 2:21:56 PM    Move-VM        VIContainer parameter: Could not find any of the objects specified by name.
At line:1 char:24
+ Get-VM -Name LACT246 | Move-VM -Destination Desktops
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (VMware.VimAutom...ner Destination:RuntimePropertyInfo) [Move-VM], ObnRecordProcessingFailedException
    + FullyQualifiedErrorId : Core_ObnSelector_SetNewParameterValue_ObjectNotFoundCritical,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

Move-VM : 4/1/2015 2:21:57 PM    Move-VM        Access to resource settings on the host is restricted to the server that is managing it: '10.50.240.9'.
At line:1 char:24
+ Get-VM -Name LACT246 | Move-VM -Destination Desktops
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Move-VM], HostAccessRestrictedToManagementServer
    + FullyQualifiedErrorId : Client20_VMServiceImpl_MoveIntoResourcePool_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>
0
Jason YuAuthor Commented:
If I moved the vm to that host, then I could use the following command to move the same host to the resource pool. I am kind of don't like these two steps method, can I do it in one step in the CLI.

thanks.


PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-VM -Name LACT25 | Move-VM -Destination Desktops
Move-VM : 4/1/2015 2:27:14 PM    Move-VM        Access to resource settings on the host is restricted to the server that is managing it: '10.50.240.9'.
At line:1 char:23
+ Get-VM -Name LACT25 | Move-VM -Destination Desktops
+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Move-VM], HostAccessRestrictedToManagementServer
    + FullyQualifiedErrorId : Client20_VMServiceImpl_MoveIntoResourcePool_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM


Name                 PowerState Num CPUs MemoryGB
----                 ---------- -------- --------
LACT25               PoweredOn  1        6.000
0
gheistCommented:
Hosts dont have resource pools. Resource pools are privilege of vcenter clusters.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Jason YuAuthor Commented:
If I want to refer to the resource pool on the vcenter cluster, how can I do it?

thanks.
0
gheistCommented:
You can specify any destination by name - storage volume, host, cluster, resource pool etc.
0
Jason YuAuthor Commented:
if my cluster name is "Cluster7_windows" and the hostname is "ca-vmhost11" and resource poolname is "desktops"

How could I refer to the resource name in the powerCLI?

thanks.
0
gheistCommented:
One destination at a time.
First host in different cluster, then resource group.
https://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Move-VM.html
0
Jason YuAuthor Commented:
Got it, so there is no one step way, I have to move the vm into the cluster before I can put it into the resource pool on that cluster.
0
Jason YuAuthor Commented:
got it, thank you guys.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VMware

From novice to tech pro — start learning today.