Example 3: Script containing Start-TpmsSetupByAgent
Description
Sends the target machine definitions set by New-TpmsObjSetupAgent to Tpms.Service to retrieve the certificates.
Syntax
Start-TpmsSetupByAgent -Servers <psobject[]>
Parameter | Description |
-Servers | list of target machine variables, examples: $srv1 or ($srv1) ($srv1,$srv2,$srv3) |
Example 1: cmdlet usage
The following example sends the definition of the target machine $srv2 to Tpms.Service.
$srv2 = New-TpmsObjSetupAgent ' -Name "cps47.ourdomain.local" ' -Port 5050 ' -Credential (Get-Credential -Message "Please enter your credentials." -UserName "ourdomain\Administrator")
Start-TpmsSetupByAgent -Servers ($srv2)
Example 2: cmdlet usage
The following example sends the definition of the two target machines $srv1 and $srv2 to Tpms.Service.
$srv1 = New-TpmsObjSetupAgent ' -Name "cps007.ourdomain.local" ' -Port 5050 ' -Credential (Get-Credential -Message "Please enter your credentials." -UserName "ourdomain\Administrator")
$srv2 = New-TpmsObjSetupAgent ' -Name "cps47.ourdomain.local" ' -Port 5050 ' -Credential (Get-Credential -Message "Please enter your credentials." -UserName "ourdomain\Administrator")
Start-TpmsSetupByAgent -Servers ($srv1,$srv2)
Example 3: Script containing Start-TpmsSetupByAgent
The following script can be run on an admin computer to initiate the Tpms environment. The script must run only once per session. It imports the module Tpms.Powershell, sets the URL of Tpms.Service and sets the log level to Info, defines a target server ($srv2) running Tpms.Agent (cps47.ourdomain.local) and – finally – sends the relevant calls with Start-TpmsSetupByAgent -Servers ($srv2).
Set-TpmsServiceUrl -Uri https://licenseserver.ourdomain.local:4040
Set-TpmsLogLevel -RelayLogLevel Info
$srv2 = New-TpmsObjSetupAgent -Name "cps47.ourdomain.local" -Port 5050 -Credential (Get-Credential -Message "Please enter your credentials." -UserName "ourdomain\Administrator")
Start-TpmsSetupByAgent -Servers ($srv2)