Get-SCVMMServer

Get-SCVMMServer

Connects to a VMM management server if a connection does not already exist, or connects to a different VMM management server.

Syntax

Parameter Set: Default
Get-SCVMMServer [-ComputerName] <String> [-AllowJobGC] [-ConnectAs <Profile]> ] [-Credential <PSCredential> ] [-ForOnBehalfOf] [-RetainDeletedObjects] [-RetainObjectCache] [-SetAsDefault] [-TCPPort <Int32> ] [-UserRoleName <String> ] [ <CommonParameters>]

Detailed Description

The Get-SCVMMServer cmdlet connects to a Virtual Machine Manager (VMM) management server if a connection does not already exist and retrieves the server object from the VMM database. The default port used to connect to a VMM server is TCP port 8100.

If you have created a connection to a VMM management server using the user interface (UI), when you open a VMM command shell, that command shell automatically connects to the same VMM management server. If you have not previously connected to the VMM management server using the UI, you need to use Get-SCVMMServer to establish a connection. Note that if you connect to a VMM management server only using the VMM command shell, you will need to use the SetAsDefault parameter to retain the connection from session to session, or re-connect to the VMM server each time you open a new VMM command shell session.

You can also use Get-VMMServer to connect to a different VMM management server.

After a connection to the VMM management server is established, all future commands run at the VMM command shell command line that require the VMM server object will automatically use the existing connection until you close that VMM command shell window.

The VMM service running on the VMM management server supports the VMM database. This database is stored in Microsoft SQL Server either on the VMM management server itself or on a separate server running SQL Server.

The VMM service enables you to manage your virtual environment, including host servers (which host virtual machines), library servers (which store VMM library resources), and virtual machines deployed on a host or stored in the library.

For more information about connecting to the VMM management server, type Get-Help about_VMM_2012_Connecting_to_the_VMM_Server.

Parameters

-AllowJobGC

Indicates that garbage collection is allowed for jobs.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String>

Specifies the name of a computer that VMM can uniquely identify on your network. Valid formats are:

-- FQDN
-- IPv4 or IPv6 address
-- NetBIOS name

NOTE: See the examples for a specific cmdlet to determine how that cmdlet specifies the computer name.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ConnectAs<Profile]>

Specifies the VMM user role to use, if the user is a member of more than one role, when connecting to the VMM management server from the VMM command shell. Valid values are:

-- Administrator
-- DelegatedAdmin
-- ReadOnlyAdmin
-- SelfServiceUser

VMM Administrators can manage all VMM objects. Delegated Administrators and Self-Service users can access and change only the objects that are within the scope of their user roles. Read-Only Administrators can only view the properties of existing objects; they cannot create new objects or change the properties of existing objects.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<PSCredential>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ForOnBehalfOf

Indicates that an administrator is able to use OnBehalfOf parameters, when available, for VMM cmdlets. This parameter is primarily used for Service Provider Foundation connections to VMM.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RetainDeletedObjects

Indicates that objects in the cache that are marked for deletion will be preserved. You might need this parameter only if you create a user interface on top of the VMM command shell.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RetainObjectCache

Indicates that the objects in the cache will remain in memory and will not be reclaimed by garbage collection. You might need this parameter if you create a user interface on top of the VMM command shell.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SetAsDefault

Indicates, when set to $True, that the VMM command shell connects to the specified VMM management server for this session and retains that connection for future sessions.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-TCPPort<Int32>

Specifies a numeric value that represents a TCP port.

Aliases

Port

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UserRoleName<String>

Specifies the name of a user role. Types of user roles that are named include Delegated Administrator, Read-Only Administrator and Self-Service User.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Connect to a VMM server

This command connects to the VMM server named VMMServer01 located in the Contoso domain and gets the server object from the VMM database.

PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"

Example 2: Connect to a VMM server through a specific port

This command connects over TCP port 8100 to the VMM server named VMMServer01 located in the Contoso domain.

PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com" -TCPPort 8100

Example Example 3: Connect to a VMM server and get its .NET object type, methods, and properties.

The first command gets the VMM server object named VMMServer01, and then stores the object in the $VMMServer variable.

The second command passes the VMM server object stored in $VMMServer to the Get-Member cmdlet, which retrieves and displays the following:

-- TypeName. The name of the .NET type of the VMM server object: Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection.

-- MemberType. A list containing the name and definition for each event, method, and property associated with this object type.

The third command retrieves and displays the same information as the second command, except that it passes the output to the Format-List cmdlet by using the pipeline operator so that the complete definition for each method and each property for the VMM server object is displayed.

PS C:\> $VMMServer = Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
PS C:\> $VMMServer | Get-Member
PS C:\> $VMMServer | Get-Member | Format-List

Example 4: Connect to a different VMM server with a different user role

This command connects to the VMM server named VMMServer02 located in the Contoso domain using the DelegatedAdmin user role.

PS C:\> Get-SCVMMServer -ComputerName "VMMServer02.Contoso.com" -ConnectAs "DelegatedAdmin"

Restart-SCJob

Set-SCVMMServer