AddHostsInTrustedADdomain.ps1

適用於: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1

The following script adds two Windows Server-based hosts in a trusted Active Directory Domain to System Center Virtual Machine Manager (VMM). You can add more than two hosts by including additional host computer names in the $VMHosts variable.

Disclaimer

# Filename:      AddHostsInTrustedADdomain.ps1
# Description:   Adds hosts to VMM.

# Connect to the VMM server.
Get-VMMServer –ComputerName "VMMServer1.Contoso.com"

# Define the variables.
$Credential = get-credential
$VMHostGroup = Get-VMHostGroup "All Hosts"
$VMHosts = "VMMHost1.Contoso.com", "VMMHost2.Contoso.com"

# Add each host computer.
foreach ( $VMHost in $VMHosts )
{
   Add-VMHost -ComputerName $VMHost -Credential $Credential -VmPaths "D:\VirtualMachinePath " -RunAsynchronously -VMHostGroup $VMHostGroup 
}

另請參閱

概念

AddHostCluster.ps1