< Back

Connect-CisServer

Sun Jan 19, 2020 6:47 pm

NAME Connect-CisServer



SYNOPSIS

This cmdlet establishes a connection to a vSphere Automation SDK server.





SYNTAX

Connect-CisServer [-Server] <String[]> -Credential <PSCredential> [-Force] [-NotDefault] [-Port <Int32>]

[-SaveCredentials] [<CommonParameters>]



Connect-CisServer [-Server] <String[]> [-Force] [-NotDefault] [-Password <SecureString>] [-Port <Int32>]

[-SaveCredentials] [-User <String>] [<CommonParameters>]



Connect-CisServer [-Server] <String[]> [-Force] [-NotDefault] [-Port <Int32>] -SessionSecret <String>

[<CommonParameters>]



Connect-CisServer [-Server] <String[]> [-Force] [-NotDefault] [-Port <Int32>] -SamlSecurityContext

<SamlSecurityContext> [<CommonParameters>]



Connect-CisServer -Menu [<CommonParameters>]





DESCRIPTION

This cmdlet establishes a connection to the vSphere Automation SDK server specified by the -Server parameter.



The connect and disconnect operations for a server are using a reference counting mechanism. Every server is

identified by its connection string which contains server, user name, and port. If there is already an existing

connection to the server for a specific user name and port, a new connection is not established. Instead, the

cmdlet returns the object which represents the existing connection. The RefCount property of the object is

incremented by one. Note that the returned object is the same as the one previously returned. Therefore, the

RefCount of the previously returned object will be updated as well. When a server is disconnected, then its

RefCount property is decreased by one. If this number becomes equal to zero, then the server is disconnected.



PowerCLI for vSphere Automation SDK supports a list of default servers. When an operation is performed, if the

target servers cannot be determined from the specified parameters, the cmdlet runs against the servers in the

default server list. They are kept in a global variable called $DefaultCisServers. It is of an array type and its

initial value is an empty array. When you connect to a server, the server is added at the beginning of the array,

unless -NotDefault parameter is specified. When you disconnect from a server, the server is removed from the

$DefaultCisServers variable. When all servers are removed from the variable its value is an empty array. You can

modify the value of the $DefaultCisServers variable manually.





PARAMETERS

-Credential <PSCredential>

Specifies a PSCredential object that contains credentials for authenticating with the server. For more

information about the server authentication logic of PowerCLI, run "help about_server_authentication".



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Suppresses all user interface prompts during the cmdlet execution. Currently, these include 'Multiple default

servers' and 'Invalid certificate action'.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Menu [<SwitchParameter>]

Indicates that you want to select a connection server from a list of recently connected servers. If Menu is

set to $true, the cmdlet retrieves a list of the last visited servers and enters a nested command prompt, so

that you can select a server from the list.



Required? true

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-NotDefault [<SwitchParameter>]

Specifies that you do not want to save the specified servers as default servers.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Password <SecureString>

Specifies the password you want to use for authenticating with the server. If the Credential parameter is also

specified, this parameter is ignored. For more information about the server authentication logic of PowerCLI,

run "help about_server_authentication".



Note: If the password contains special characters, enclose the entire string in single quotes (').



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Port <Int32>

Specifies the port on the server you want to use for the connection.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-SamlSecurityContext <SamlSecurityContext>

Specifies the SAML2 security context for the vCenter Server system. For more information about security

contexts, see the about_security_context (about_security_context.html)article.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-SaveCredentials [<SwitchParameter>]

Indicates that you want to save the specified credentials in the local credential store.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Server <String[]>

Specifies the IP or DNS addresses of the vSphere Automation SDK servers you want to connect to.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-SessionSecret <String>

Specifies the ID of an existing vSphere Automation SDK session you want to reestablish.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-User <String>

Specifies the user name you want to use for authenticating with the server. If the Credential parameter is

also specified, this parameter is ignored. For more information about the server authentication logic of

PowerCLI, run "help about_server_authentication".



Note: If the user name contains special characters, enclose the entire string in single quotes (').



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, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

CisServer







NOTES









-------------------------- Example 1 --------------------------



Connect-CisServer -Server $serverAddress -User $user -Password $pass



Connects to a vSphere Automation SDK server by using the User and Password parameters.

-------------------------- Example 2 --------------------------



$credential = Get-Credential

Connect-CisServer -Server $serverAddress -Credential $credential



Connects to a vSphere Automation SDK server by using the Credential parameter.

-------------------------- Example 3 --------------------------



$serverConnection = Connect-CisServer -Server $serverAddress -User $user -Password $pass

Connect-CisServer -Server $serverAddress -SessionSecret $serverConnection.SessionSecret



Connects to a vSphere Automation SDK server by using the SessionSecret parameter.

-------------------------- Example 4 --------------------------



Connect-CisServer -Server $serverAddress -Credential -User $user -Password $pass -SaveCredential



Connects to a vSphere Automation SDK server and stores the credentials in the credential store.

-------------------------- Example 5 --------------------------



Connect-CisServer -Server $serverAddress -User $user



Connects to a vSphere Automation SDK server when a record for the specified user is available in the credential

store.

-------------------------- Example 6 --------------------------



$oauthCtx = New-VcsOAuthSecurityContext -ApiToken "a3f35067-80b5-44f0-a0bc-e19f2bc17fb7"

$samlCtx = New-VISamlSecurityContext -VCenterServer $serverAddress -OAuthSecurityContext $oauthCtx

Connect-CisServer -Server $serverAddress -SamlSecurityContext $samlCtx



Connects to a vSphere Automation SDK server that runs in a VMware managed cloud using an API token from the VMware

Cloud Services portal.



RELATED LINKS

Online Version: https://code.vmware.com/doc/preview?id= ... erver.html

Disconnect-CisServer