This article describes how to perform an unattended setup of a WATS Client using a Powershell script.
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_6.0.240_x64.msi is an example):
msiexec /i "WATSClient_6.0.240_x64.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_6.0.240_x64.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_6.0.240_x64.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
$tdmURL="https://youraccount.wats.com"
#Location of your test station
$tdmLocation="Drammen, Norway"
#Purpose of your test station
$tdmPurpose="Client test"
#The Client register token is received when you register your account
$tdmClientRegisterToken="cmVnaXN0ZXJDbGllbnRUb2tlbjpmbjVuNGthZTQ5bnJkYW11eHhrZ2Zy"
#The next statements locates the installed TDM assembly, and makes it available to PowerShell.
$tdmdll=[Reflection.Assembly]::LoadWithPartialName("Virinco.WATS.Interface.TDM").Location
Add-Type -Path $tdmdll
$tdmapi = New-Object Virinco.WATS.Interface.TDM
#$tdmDataFolder is the full path to the location to the WATS folder containing settings, logs and offline reports
$tdmDataFolder=[Environment]::GetFolderPath([System.Environment+SpecialFolder]::CommonApplicationData)+"\Virinco\WATS"
$tdmapi.SetupAPI($tdmDataFolder, $tdmLocation, $tdmPurpose, $true)
$tdmapi.RegisterClient($tdmURL, "", $tdmClientRegisterToken)
#PS - instead of using $tdmClientRegisterToken, you can use a WATS username and password that has the RegisterClient permission
#$tdmapi.RegisterClient($tdmURL, "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 = 'TS2020x64'
$path = "C:\Program Files\Virinco\WATS\Virinco.WATS.Client.Configurator.exe"
[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 = '20.0'
$path = "C:\Program Files\Virinco\WATS\Virinco.WATS.Client.Configurator.exe"
[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 Core assembly, and makes it available to PowerShell
$coredll=[Reflection.Assembly]::LoadWithPartialName("Virinco.WATS.WATS-Core").Location
Add-Type -Path $coredll
#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
$tdmapi.InitializeAPI([Virinco.WATS.Interface.TDM+InitializationMode]::NoConnect, $false)
NOTE: To combine with 'Connect WATS Client to WATS', insert this between $tdmapi.SetupAPI and $tdmapi.RegisterClient
Set Custom Identifier
#Custom identifier
$customIdentifier = "11112222-3333-4444-5555-666677778888"
#The next statements locates the installed WATS Core assembly, and makes it available to PowerShell
$coredll=[Reflection.Assembly]::LoadWithPartialName("Virinco.WATS.WATS-Core").Location
Add-Type -Path $coredll
#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 $tdmapi.SetupAPI and $tdmapi.RegisterClient
Comments
0 comments
Please sign in to leave a comment.