Get-SCVMMServer

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

Description

The Get-SCVMMServer cmdlet connects to a System Center 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 managment 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".

For more information about Get-SCVMMserver, type: "Get-Help Get-SCVMMServer -online".

Parameters

ComputerName

Required? true
Accept Pipeline Input? false
Position? 0
Specifies the name of a computer that VMM can uniquely identify on your network. Valid formats are: FQDN, IPv4 or IPv6 address, or NetBIOS name.

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

ConnectAs

Required? false
Accept Pipeline Input? false
Position? named
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.

Credential

Required? false
Accept Pipeline Input? false
Position? named
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".

RetainDeletedObjects

Required? false
Accept Pipeline Input? false
Position? named
Specifies 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.

RetainObjectCache

Required? false
Accept Pipeline Input? false
Position? named
Specifies 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.

SetAsDefault

Required? false
Accept Pipeline Input? false
Position? named
Indicates, when set to $True, that the VMM command shelll connects to the specified VMM management server for this session and retains that connection for future sessions.

TCPPort

Required? false
Accept Pipeline Input? false
Position? named
Specifies a numeric value that represents a TCP port. 

UserRoleName

Required? false
Accept Pipeline Input? false
Position? named
Specifies the name of a user role. Types of user roles that are named include Delegated Administrator, Read-Only Administrator and Self-Service User.

Examples

1: Connect to a VMM server.
PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
This command connects to the VMM server named VMMServer01 located in the Contoso domain and gets the server object from the VMM database.
2: Connect to a VMM server through a specific port.
PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com" -TCPPort 8100
This command connects over TCP port 8100 to the VMM server named VMMServer01 located in the Contoso domain.
3: Connect to a VMM server and get its .NET object type, methods, and properties.
PS C:\> $VMMServer = Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
PS C:\> $VMMServer | Get-Member
PS C:\> $VMMServer | Get-Member | Format-List
The first command gets the VMM server object named VMMServer01 and 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 wtih this object type.

The third command retrieves and displays the same information as the second command, except that it pipes the output to the Format-List cmdlet so that the complete definition for each method and each property for the VMM server object is displayed.
4: Connect to a different VMM server with a different user role.
PS C:\> Get-SCVMMServer -ComputerName "VMMServer02.Contoso.com" -ConnectAs "DelegatedAdmin"
This command connects to the VMM server named VMMServer02 located in the Contoso domain using the DelegatedAdmin user role.

See Also