Használata a Számítógéprétegek történő leállítása és a virtuális gépek (parancsfájl) szolgáltatás indítási sorrendje határozza meg az egyéni tulajdonságok

 

Érvényes: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager

Hoz létre, és egyéni tulajdonságok hozzáadása az objektumok System Center 2012 – Virtual Machine Manager (VMM). Új egyéni tulajdonság létrehozásához használja a New-SCCustomProperty parancsmagot. Létrehozásakor, vagy frissíteni az egyéni tulajdonság, amely objektumokat a tulajdonság használatával alkalmazható meghatározhatja a AddMember paraméter. Egyéni tulajdonságok vonatkozik virtuális gépek, a virtuálisgép-sablonok, az állomások, a gazdagépfürtök, a gazdagép-csoportok, a szolgáltatási sablonok, a számítógép szintek és a felhők. Egyéni tulajdonság létrehozása és egy objektum felvett, után érték hozzáadása az egyéni tulajdonság és megteszi a szükséges az objektumon, az egyéni tulajdonság értéke alapján.

A Jótállás kizárása

A következő parancsfájl hoz létre a számítógép-szint objektumok egyéni tulajdonság. Az egyéni tulajdonságok, amelyek meghatározzák a virtuális gépek használata a szintek indítási és leállítási sorrendjének értékek majd vonatkozik.

<#
  Description:   This script creates a custom property for computer tier objects.
                 The script then applies values to the custom properties on the
                 computer tiers. Based on property values, the script stops the 
                 virtual machines in the specified order, and then starts the 
                 virtual machines, also in the specified order.
#>

# Create custom properties for the computer tiers.
$CustomProp = New-SCCustomProperty -Name StopStartOrder -AddMember "ComputerTier"

# Get the computer tiers on which you want to set the shutdown and startup order.
$Service = Get-SCService -Name "NewService6"
$Tiers = Get-SCComputerTier -Service $Service
$TierNumber = $Tiers.count

# Set the shutdown/startup order custom property on the computer tiers.
$ComputerTier1 = Get-SCComputerTier -Service $Service | where {$_.Name -eq "Web Tier"}
Set-SCCustompropertyValue -CustomProperty $CustomProp -InputObject $ComputerTier1 -Value "1"
$ComputerTier2 = Get-SCComputerTier -Service $Service | where {$_.Name -eq "ComputerTier2"}
Set-SCCustompropertyValue -CustomProperty $CustomProp -InputObject $ComputerTier2 -Value "2"

# Stop the virtual machines in order before stopping the service.
$i = 1
While ($i -le $TierNumber)
{
   Get-SCComputerTier -Service $Service | where {$_.CustomProperty.Values -eq "$i"} | Get-SCVirtualMachine | Stop-SCVirtualMachine -Shutdown

   $i = $i+1
}

# Stop the service.
Stop-SCService -Service $Service

# Pause to ensure that the service is stopped.
Start-Sleep "30"

# Start the virtual machines in order before starting the service.
$i = 1
While ($i -le $TierNumber)
{
   Get-SCComputerTier -Service $Service | where {$_.CustomProperty.Values -eq "$i"} | Get-SCVirtualMachine | Start-SCVirtualMachine

   $i = $i+1
}

# Start the service.
Start-SCService -Service $Service