You can associate
a storage policy with a virtual machine and its hard disk and check if they are
compliant with the policy.
Prerequisites
- Verify that you are
connected to a
vCenter
Server
system.
- Verify that a storage
policy named
Str-Policy exists in
the
vCenter
Server
environment.
- Verify that a virtual
machine named
Target-VM exists in the
vCenter
Server
environment.
Procedure
-
Get the
Str-Policy storage
policy and store it in the
$policy variable.
$policy = Get-SpbmStoragePolicy -Name 'Str-Policy'
-
Get the
Target-VM virtual
machine and store it in the
$vm
variable.
$vm = Get-VM -Name 'Target-VM'
-
Get the hard disk
associated with the
$vm
virtual machine and store it in the
$hd
variable.
$hd = Get-HardDisk -VM $vm
-
Assign the
$policy storage policy
to the
$vm
virtual machine and the
$hd
hard disk.
Set-SpbmEntityConfiguration $vm, $hd -StoragePolicy $policy
-
View the
$policy storage
policy's compliance with the
$vm
virtual machine and the
$hd
hard disk.
Get-SpbmEntityConfiguration $vm, $hd
Note: The storage policy
can be compliant only if the datastore on which the virtual machine and hard
disk are created is compliant with the storage policy.