This article describes how to perform an unattended setup of a WATS Client 7.x or newer using a Powershell script. For unattended setup of WATS Client 6.x, see How to do an unattended Install/Setup of WATS Client (6.x)
The first step is to download the installer package (.msi) to a location where the client can reach it. You can find a download link at download.wats.com
Install the WATS Client
To install the WATS Client without user interaction, use this command (WATSClient_7.0.133.msi is an example):
msiexec /i "WATSClient_7.0.133.msi" /passive
Installer properties
When installing the WATS Client without user interaction you can set some properties to use instead of their defaults:
Property | Values | Description |
LAUNCHMODE | NEVER, ALWAYS | Default opens WATS Client Configurator window on first install, not on upgrade. NEVER will never open the window after install, ALWAYS will always open the window after install. |
LICENSETYPE | Production, Development | Default Production. Set license type to Production if WATS Client is used in production or to Development if it is used to develop tests. |
REMOVE | PackageManagerFeature | Default is to update installed optional features and not update not installed optional features. Except features added this version are default installed. Set REMOVE to ensure a feature is not installed. |
Example:
msiexec /i "WATSClient_7.0.133.msi" LAUNCHMODE=NEVER /passive
When combining this command with the powershell scripts below, it should look like this, to make the script wait until the installation is complete:
start-process msiexec -Wait -ArgumentList '/i "WATSClient_7.0.133.msi" LAUNCHMODE=NEVER /passive'
Connect WATS Client to WATS
To setup and configure the client, you can use this Powershell script:
#Url to your wats instance
$clientURL="https://youraccount.wats.com"
#Location of your test station
$clientLocation="Drammen, Norway"
#Purpose of your test station
$clientPurpose="Client test"
#The Client register token is received when you register your account
$clientRegisterToken="cmVnaXN0ZXJDbGllbnRUb2tlbjpmbjVuNGthZTQ5bnJkYW11eHhrZ2Zy"
#The next statements locates the installed WATS Client API assembly, and makes it available to PowerShell.
$clientdll="C:\Program Files\Virinco\WATS\Virinco.WATS.ClientAPI.dll"
Add-Type -Path $clientdll
$clientapi = New-Object Virinco.WATS.Interface.client
#$clientDataFolder is the full path to the location to the WATS folder containing settings, logs and offline reports
$clientDataFolder=[Environment]::GetFolderPath([System.Environment+SpecialFolder]::CommonApplicationData)+"\Virinco\WATS"
$clientapi.SetupAPI($clientDataFolder, $clientLocation, $clientPurpose, $true)
$clientapi.RegisterClient($clientURL, "", $clientRegisterToken)
#PS - instead of using $clientRegisterToken, you can use a WATS username and password that has the RegisterClient permission
#$clientapi.RegisterClient($clientURL, "UserName","Password")
Install WATS TestStand add-on
To install a TestStand add-on you can use this Powershell script:
#The TestStand version to install the add-on to (See list of possible ids in C:\ProgramData\Virinco\WATS\Deploy.xml)
$testStandId = 'TS2024x64'
$path = "C:\Program Files\Virinco\WATS\Virinco.WATS.Client.Configurator.dll"
[Reflection.Assembly]::LoadFrom($path)
$addons = [Virinco.WATS.Client.Configurator.SupportFiles.Deploy]::GetDeploymentConfigurations()
$addon = $addons | Where-Object {$_.Id -eq $testStandId} | Select -index 0
$addon.DeployFiles($true, $false)
Install WATS LabVIEW add-on
To install a LabVIEW add-on you can use this Powershell script:
#The LabView version to install the add-on to
$labViewVersion = '24.0'
$path = "C:\Program Files\Virinco\WATS\Virinco.WATS.Client.Configurator.dll"
[Reflection.Assembly]::LoadFrom($path)
$addons = [Virinco.WATS.Client.Configurator.Pages.LabViewToolkitViewModel]::GetLabViews()
$addon = $addons | Where-Object {$_.Version -eq $labViewVersion} | Select -index 0
$addon.DeployFiles($true)
Configure proxy
To configure proxy you can use this Powershell script:
#Proxy address
$proxyAddress = "http://myproxy"
#Proxy domain
$proxyDomain = "domain"
#Proxy username
$proxyUsername = "username"
#Proxy password
$proxyPassword = "12345678"
#The next statements locates the installed WATS Client API assembly, and makes it available to PowerShell.
$clientdll="C:\Program Files\Virinco\WATS\Virinco.WATS.ClientAPI.dll"
Add-Type -Path $clientdll
#Set proxy settings
$proxy = New-Object Virinco.WATS.Configuration.ProxySettings
$proxy.Method = 2
$proxy.Address = $proxyAddress
$proxy.Domain = $proxyDomain
$proxy.Username = $proxyUsername
$proxy.Password = $proxyPassword
#Save proxy settings
$resthelper = New-Object Virinco.WATS.REST.ServiceProxy
$resthelper.LoadSettings()
$resthelper.ProxySettings = $proxy
$resthelper.SaveSettings()
#Make TDM API use new proxy settings when registering
$clientapi.InitializeAPI([Virinco.WATS.Interface.TDM+InitializationMode]::NoConnect, $false)
NOTE: To combine with 'Connect WATS Client to WATS', insert this between $clientapi.SetupAPI and $clientapi.RegisterClient
Set Custom Identifier
#Custom identifier
$customIdentifier = "11112222-3333-4444-5555-666677778888"
#The next statements locates the installed WATS Client API assembly, and makes it available to PowerShell.
$clientdll="C:\Program Files\Virinco\WATS\Virinco.WATS.ClientAPI.dll"
Add-Type -Path $clientdll
#Set custom identifier
[Virinco.WATS.Env]::IdentifierType = [Virinco.WATS.ClientIdentifierType]::Custom
[Virinco.WATS.Env]::MACAddressRegistered = $customIdentifier
NOTE: To combine with 'Connect WATS Client to WATS', insert this between $clientapi.SetupAPI and $clientapi.RegisterClient
Comments
0 comments
Please sign in to leave a comment.