Login and logout

Connect-XpServer

Syntax

Connect-XpServer [([-UserName] <String> [-Password] <String>) | ([-PSCredential] <PSCredential>)]

Description

The command authenticates the current PowerShell session on the XPhone Connect Server.

Before executing the first XPhone Connect Server command in the PowerShell, the login information usually needs to be entered in a window which is automatically shown after the first command is entered.

Automated scripts which always run at night, for example, for entering new users from the Active Directory in teams can not open any entry screens and require user interaction.

This command enables the access data to be provided either in the script (insecure) or in an encrypted file (more secure, recommended) for automated scripts.

Parameter

  • -UserName <String>
    • The user name of an XPhone Connect Server system administrator to be used for access via PowerShell commands.

  • -Password <String>
    • The password for a user name of an XPhone Connect Server system administrator to be used for access via PowerShell commands.

  • -PSCredential <PSCredential>
    • A login data object generated by Get-Credential, for example. For further information, see examples.

Hint

If the command is called without parameters, a graphic entry screen opens for manual authentication of the session.

Input

This command does not support input via the pipeline and is usually at the beginning of a command chain.

Output

The Connect-XpServer command delivers a Boolean-type object. The value indicates whether the login was successful (True) or not (False). This can be evaluated in a script, for example, in order to cancel if login is not possible at the Server.

Example

  1. Create an encrypted “access file” which can then be used by several scripts for automatic authentication at the XPhone Connect Server:

    >$credential = Get-Credential
    >$credential | Export-CliXml -Path "D:\authenticate.xml"
    

Pipeline explanation:

  1. The first step opens the familiar login window.

  2. The login data entered is then encrypted and saved in the D:\authenticate.xml file.

Attention

This file can only be read on the same computer and with the same Windows user account under which it was created. The script used by this file must therefore be run under exactly the same user account as the one with which the file was created.

  1. Import the access file and run the subsequent commands:

    >$credential = Import-CliXml -Path "D:\Zugang.xml";
    >Connect-XpServer $credential;
    ># Restliches Skript
    >Disconnect-XpServer;
    

Disconnect-XpServer

Syntax

Disconnect-XpServer

Description

This command removes the XPhone Connect Server access data from the current PowerShell session.

In order to execute other commands on the XPhone Connect Server, the session needs to be authenticated again. This is done via Connect-XpServer, for example, or via the login screen which automatically appears when any XPhone Connect Server command is entered.

Parameter

This command is used without additional parameters.

Input

This command does not support input via the pipeline.

Output

This command does not deliver any objects.

Example

Remove the login information from the current session to enable a colleague to use the PowerShell without having to change XPhone Connect Server data:

>Connect-XpServer „admin" „admin";
>Get-XpUsers „Max Mustermann";
>#... weitere Befehle;
>Disconnect-XpServer;

As of line 4, other commands to the XPhone Connect Server must be re-authenticated.

Have you found an mistake on this page?

Please send us a hint about this error by mail to doku@c4b.de. Thank you very much!