VMware vSphere

 View Only
  • 1.  New-VM using powercli

    Posted Jul 14, 2018 05:18 PM

    Hi,

        $myCluster = Get-Cluster -Name "MyCluster"

        $myVDPortGroup = Get-VDPortgroup -Name "DPortGroup-Default"

        $mySharedDatastore = Get-Datastore -Name "vsanDatastore"

        New-VM -Name powercliVM03 -ResourcePool $myCluster -Portgroup $myVDPortGroup -DiskGB 1 -MemoryGB 1 -Datastore $mySharedDatastore

    say I have 5 hosts in the cluster with DRS disabled, how is the decision made as in which host will the VM be created on?

    Can I specify a host directly within the cluster?

    Thanks



  • 2.  RE: New-VM using powercli

    Posted Jul 14, 2018 05:32 PM

    Use the switch <-VMHost> to specify the host on which the VM should be created -

    New-VM -VMHost hostname -Name powercliVM03 .....

    Please consider marking this answer as "correct" or "helpful" if you think your questions have been answered.

    Cheers,

    Supreet



  • 3.  RE: New-VM using powercli

    Posted Jul 14, 2018 06:16 PM

    ok, will I still need to specify the cluster?

    Do I need to specify other parameters to ensure its disk is protected by the "vSAN Default Storage Policy" as even though the datastore is set "vsanDatastore" in the command, am noticing that the disk is created as a Thick provision lazy zeroed.

    Thanks



  • 4.  RE: New-VM using powercli

    Posted Jul 16, 2018 01:42 PM

    Per my understanding, we need to assign the storage policy to the VM. Please refer to step-8 in the below link -

    VMware vSphere 6.5 Documentation Library

    Cheers,

    Supreet