Open navigation

Connect-TP

Description

Syntax

Example 1

Example 2

Example 3

Example 4



Description

Establishes the required connection to the license server. Providing credentials is required.


Syntax

Connect-TP -TPUrl <String> [-PSCredential <PSCredential>]
ParameterDescription
-TPUrlURL of the ThinPrint license server
-PSCredentialoptional: credentials of an account that is a member of the local ThinPrint Config­uration Admins group on the license server, such as the account that installed the software


Example 1

If only the parameter -TPUrl is used but not the -PSCredential parameter, the login information is queried with a pop-up window. Variable values are indi­cated in orange.

Connect-TP -TPUrl http://localhost:4004

ThinPrint license server's PowerShell cmdlet Connect-TP: manual entry of license server logon information

manual entry of license server logon information

ThinPrint license server's PowerShell cmdlet Connect-TP: successfully connected to the license server

successfully connected to the license server


Example 2

If the parameter -PSCredential is only used to pass the account name, the password is still queried with a pop-up window.

Connect-TP -TPUrl http://localhost:4004 -PSCredential (Get-Credential -Message "Please enter your credentials." -UserName "ourdomain\licservice")

ThinPrint license server's PowerShell cmdlet Connect-TP: manual password entry

manual password entry

ThinPrint license server's PowerShell cmdlet Connect-TP: connection with the license server successfully established including transfer of the account name

connection with the license server successfully established including transfer of the account name


Example 3

The -PSCredential parameter is used to pass both user name and password. How­ever, the password appears in the plain text ("12345678").

$username = "ourdomain\licservice"
$password = ConvertTo-SecureString "12345678" -AsPlain­Text -Force
$credentials = New-Object System.Management.Automa­tion.PSCredential ($username,$password)
Connect-TP -TPUrl http://localhost:4004 -PSCredential $credentials

ThinPrint license server's PowerShell cmdlet Connect-TP: connection with the license server with the transfer of the complete creden­tials successfully established

connection with the license server with the transfer of the complete creden­tials successfully established


Example 4

The first script EncryptPW.ps1 only needs to be executed once. It queries the pass­word and stores it encrypted in c:\scripts\template.ps1.
The second script template.ps1 then logs in to the license server using the encrypted password. This script can then be used for any login to the license server without having to enter a password. Here, the license server address is http://local­host:4004.

  • Contents of the EncryptPW.ps1 script for querying the password and generating the script template.ps1 (variable values are shown in orange):
# Path to the script to be created:
$path = 'c:\scripts\template.ps1'

# Create empty template script:
New-Item -ItemType File $path -Force -ErrorAction SilentlyContinue

$user = Read-Host 'Enter Username'
$pwd = Read-Host 'Enter Password' -AsSecureString
$key = 1..32 | ForEach-Object { Get-Random -Maximum 256 }
$pwdencrypted = $pwd | ConvertFrom-SecureString -Key $key

$private:ofs = ' '
('$password = "{0}"' -f $pwdencrypted) | Out-File $path
('$key = "{0}"' -f "$key") | Out-File $path -Append

'$passwordSecure = ConvertTo-SecureString -String $password -Key ([Byte[]]$key.Split(" "))' | Out-File $path -Append
('$cred = New-Object system.Management.Automa­tion.PSCredential("{0}", $passwordSecure)' -f $user) | Out-File $path -Append
'$cred' | Out-File $path -Append
'Import-Module TPPowershell' | Out-File $path -Append
'Connect-TP http://localhost:4004 -PSCredential $cred' | Out-File $path -Append

ThinPrint license server's PowerShell cmdlet Connect-TP: connection to the license server successfully established by running two scripts

connection to the license server successfully established by running the two scripts EncryptPW.ps1 and template.ps1



Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.