Remove-SCVMHost
Remove-SCVMHost
Removes a virtual machine host from VMM.
構文
Parameter Set: NormalRemoval
Remove-SCVMHost [-VMHost] <Host> [-Credential <VMMCredential> ] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RemoveHostWithVMs] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: ForceRemoval
Remove-SCVMHost [-VMHost] <Host> -Force [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
詳細説明
The Remove-SCVMHost cmdlet removes one or more virtual machine hosts from Virtual Machine Manager (VMM).
The Remove-SCVMHost cmdlet operates as follows:
-- Host server only. If this computer is a Hyper-V host but is not also a library server, the host object is removed from the VMM database, and the VMM agent software is uninstalled from the physical host server.
If the host is a VMware ESX host or a Citrix XenServer host, the host object is removed from the VMM database. VMM does not install an agent on ESX hosts or XenServer hosts.
-- Host and library server. If this computer is a Hyper-V host and is also a library server, this command removes only the host functionality but leaves the library server feature in place. That is, the host object is removed from the VMM database, but the VMM agent software is not uninstalled from the physical server. The library server object remains in the database.
If the host is an ESX host, it can function only as a virtual machine host in VMM. It cannot be both a host and a library server.
-- Credentials. If a Hyper-V host is joined to an Active Directory domain, you must provide credentials for an account with appropriate permissions to remove that host computer from VMM.
You do not need to provide Active Directory credentials to remove a perimeter network host, an ESX host or a XenServer host from VMM.
-- Virtual machines. When you remove a host, the host is no longer managed by VMM. However, any virtual machines on the host server will not be removed or disassociated from the server. Any running virtual machines are not shut down. Although the virtual machines are no longer managed by VMM, they are not affected in any other way.
-- Forced removal. You can use the Force parameter with the Remove-SCVMHost cmdlet to remove a virtual machine host from VMM when you do not have appropriate credentials to manage that host or when the VMM server can no longer communicate with that host.
When you specify the Force parameter, VMM will not ask or check for credentials, nor will VMM attempt to connect to the host and uninstall the VMM agent. Hence, using the Force parameter is recommended only when cleaning up stale host records from the VMM database.
This cmdlet returns the object upon success, with the property MarkedForDeletion set to TRUE, or returns an error message upon failure.
パラメーター
-Credential<VMMCredential>
Specifies a credential object or, for some cmdlets, a Run As account object that contains the user name and password of an account that has permission to perform this action. Or, in the case of Restart-SCJob, has permission to complete a restarted task.
For more information about the PSCredential object, type Get-Help Get-Credential
. For more information about Run As accounts, type Get-Help New-SCRunAsAccount
.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-Force
Forces the operation to complete.
For example:
- Remove-SCSCVMHost -Force
Forces the removal of a host object from the VMM database.
- Stop-SCVirtualMachine -Force
Stops a virtual machine.
エイリアス |
none |
必須? |
true |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-JobVariable<String>
Specifies that job progress is tracked and stored in the variable named by this parameter.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-PROTipID<Guid]>
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-RemoveHostWithVMs
For more information about the PSCredential object, type Get-Help Get-Credential
. For more information about Run As accounts, type Get-Help New-SCRunAsAccount
.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-VMHost<Host>
Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts.
For more information about each type of host, type Get-Help Add-SCVMHost -detailed
. See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.
エイリアス |
none |
必須? |
true |
位置は? |
1 |
既定値 |
none |
パイプライン入力を許可する |
True (ByValue) |
ワイルドカード文字を許可する |
false |
-VMMServer<ServerConnection>
Specifies a VMM server object.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
True (ByValue) |
ワイルドカード文字を許可する |
false |
-Confirm
コマンドレットを実行する前に、ユーザーに確認を求めます。
必須? |
false |
位置は? |
named |
既定値 |
false |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-WhatIf
コマンドレットを実行するとどのような結果になるかを表示します。コマンドレットは実行されません。
必須? |
false |
位置は? |
named |
既定値 |
false |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
<CommonParameters>
このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。
入力
入力型は、コマンドレットにパイプできるオブジェクトの型です。
出力
出力型は、コマンドレットによって生成されるオブジェクトの型です。
例
Example 1: Remove a specific domain-joined host from VMM
The first command uses the Get-Credential cmdlet to prompt you to supply a user name and password and stores the provided credentials in the $Credential variable. For more information, type Get-Help Get-Credential
. The required credentials for this operation are a domain account with administrator rights to remove a Windows-based host server joined to an Active Directory domain from VMM.
The second command gets the host object named VMHost01, and then stores the object in the $VMHost variable.
The third command removes the host object stored in $VMHost. As this command is processed, $Credential provides credentials to Remove-VMHost, and the Confirm parameter prompts you to confirm that you do want to remove this host from VMM.
PS C:\> $Credential = Get-Credential
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01"
PS C:\> Remove-SCVMHost -VMHost $VMHost -Credential $Credential -Confirm
Example 2: Remove all hosts that are not nodes in a host cluster from VMM
The first command gets all host objects, excludes any hosts that are nodes in a host cluster, selects only those objects that represent VMware ESX hosts, perimeter network hosts, or non-trusted domain hosts, and then removes those objects from VMM if you confirm that you want to remove them. Credentials are not required to remove these hosts.
The second command prompts you to supply a user name and password for an account with permissions to remove domain-joined Windows hosts from VMM, then and stores your credentials in $Credential.
The last command gets all domain-joined Windows-based host objects that are not part of a host cluster and passes the objects to the Remove-VMHost cmdlet. As this command is processed, $Credential provides your credentials to Remove-VMHost, and the Confirm parameter prompts you to confirm that you do want to remove these hosts fromVMM.
PS C:\> Get-SCVMHost | where {$_.HostCluster -eq $NULL} | where {$_.VirtualizationPlatform -eq "VMwareESX" -or $_.PerimeterNetworkHost -eq 1 -or $_.NonTrustedDomainHost -eq 1} | Remove-SCVMHost -Confirm
PS C:\> $Credential = Get-Credential
PS C:\> Get-VMHost | where {$_.HostCluster -eq $NULL -and $_.VirtualizationPlatform -ne "VMwareESX" -and $_.PerimeterNetworkHost -eq 0 -and $_.NonTrustedDomainHost -eq 0} | Remove-VMHost -Credential $Credential -Confirm
Example 3: Remove a specific host that you can no longer access from VMM
The first command gets the host object named VMHost03, and then stores the object in the $VMHost variable.
The second command specifies the Force parameter to ensure that VMHost03 is removed from the VMM database. Credentials are not needed for this operation. The Confirm parameter prompts you to confirm that you do want to remove this host.
You can use the Force parameter to remove a host from VMM when you do not have the credentials for that host or when the VMM server can no longer communicate with that host.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost03"
PS C:\> Remove-SCVMHost -VMHost $VMHost -Force -Confirm