Remove-SCLibraryServer

Remove-SCLibraryServer

Removes a library server from VMM.

構文

Parameter Set: Default
Remove-SCLibraryServer [-LibraryServer] <LibraryServer> -Credential <VMMCredential> [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-Confirm] [-WhatIf] [ <CommonParameters>]

詳細説明

The Remove-SCLibraryServer cmdlet removes a library server object and all library objects on that library server from the Virtual Machine Manager (VMM) database. Library objects that have a corresponding file, such as .vhd or .vmdk files, stored on the server file system are not removed from the file system by this cmdlet.

This cmdlet operates as follows:

-- If this library server is also the VMM server, you cannot remove the library server, so the remove library server operation will fail.

-- If this computer is both a library server and a host, this cmdlet removes only the library server feature from VMM, but the computer continues to function as a host.

-- If this computer is only a library server, not also a host or a VMM server, the library server is removed from VMM.

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

必須?

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

-LibraryServer<LibraryServer>

Specifies a VMM library server object.

エイリアス

none

必須?

true

位置は?

1

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

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

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

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 library server object from VMM

The first command prompts you for credentials. For more information, type Get-Help Get-Credential. When the dialog box appears, type the user name and password for either a local Administrator account or a domain account with administrator rights on the library server. The command stores the credentials in the $Creds variable.

The second command retrieves the library server object named LibraryServer01 on VMMServer01, and then stores it in the $LibServ variable.

The third command removes the library server object, and all library shares on this server, from the VMM library. When the Remove-SCLibraryServer cmdlet is used with the LibraryServer parameter as shown in this example, you can pass only one library server object to the cmdlet.

PS C:\> $Creds = Get-Credential
PS C:\> $LibServ = Get-SCLibraryServer -VMMServer "VMMServer1.Contoso.com" -ComputerName "LibraryServer01.Contoso.com"
PS C:\> Remove-SCLibraryServer -LibraryServer $LibServ -Credential $Creds

Example Example 2: Remove multiple library server objects that have a specific string in their name.

The first command prompts you for credentials. When the dialog box appears, type the user name and password for either a local Administrator account or a domain account with administrator rights on the library server. The command stores the credentials in the $Creds variable.

The second command gets all library server objects from VMMServer01 with names that include the string LibraryServer and stores the returned objects in the $LibServers variable, an object array.

The third command passes each library server object in $LibServers to Remove-SCLibraryServer. That cmdlet removes each object from VMM.

PS C:\> $Creds = Get-Credential
PS C:\> $LibServers = Get-SCLibraryServer -VMMServer "VMMServer01.Contoso.com" | where { $_.Name -match "LibraryServer" }
PS C:\> $LibServers | Remove-SCLibraryServer -Credential $Creds

Example 3: Remove a highly available library server and all of its nodes

The first command uses Get-Credential to prompt you to supply a user name and password, and then stores your credentials in $Credential. The required credentials for this operation are either a local Administrator account or a domain account with administrator rights on the library server. The following commands use $Credential to pass your credentials to each cmdlet that requires credentials.

The second command uses the Find-SCCluster cmdlet to confirm that HAFileServer01 is a highly available file server, and then stores the cluster object in the $Cluster variable.

The third command removes the highly available file server by specifying its name as a library server from VMM. The command uses the RunAsynchronously parameter to return control to the shell immediately before this command completes because the last command does not need to wait until after this command finishes.

The last command uses a Foreach statement to pass each object stored in $Cluster.ClusterNodes to the Remove-SCLibraryServer cmdlet, which removes each node from VMM. The command uses the RunAsynchronously parameter to return control to the shell immediately. For more information about the Windows PowerShell Foreach statement, type Get-Help about_ForeEache.

PS C:\> $Credential = Get-Credential
PS C:\> $Cluster = Find-SCCluster -ComputerName "HAFileServer01.Contoso.com" -Credential $Credential
PS C:\> Remove-LibraryServer -LibraryServer "HAFileServer01.Contoso.com" -Credential $Credential -RunAsynchronously
PS C:\> Foreach ($Node in $Cluster.ClusterNodes) {Remove-LibraryServer -LibraryServer $Node -Credential $Credential -RunAsynchronously}

関連トピック

Add-SCLibraryServer

Get-SCLibraryServer

Remove-SCLibraryShare

Set-SCLibraryServer

Restart-SCJob

Find-SCCluster