Basic commands
List Spotlight connections
Get-Connection
Delete a Spotlight connection
See also Remove many connections.
Remove-Connection -Name connectionName -PassThru
Add a Spotlight connection
Windows authentication (using Diagnostic Server credentials)
See also Add a list of connections.
Add-Connection -Address address -Technology connectionType -Tag tag -Enabled -PassThru
Supply User / Password details
See also Add a list of connections.
Add-Connection -Credential $(get-credential) -Address address -Technology connectionType -Tag tag -Enabled -PassThru
Command-Line Procedure for Establishing Linked Database and OS Connections:
To add 2 linked connections using the command line, the following conditions must be met:
The user must add exactly 2 connections (not more or less) using a single Add-Connection Command. Out of the 2 connections, one must be a database connection and the other must be an OS connection. The user must explicitly pass the -LinkHost parameter in the command to indicate that the connections need to be linked. You can link 2 existing or new connections (one database connection and another OS connection) using the following command template:
Command template:
Add-Connection -Address <Address1>,<Address2> -Technology <technology1>,<technology2> -Enabled -PassThru -LinkHost
Replace:
-
<Address1> with address of the first connection
-
<Address2> with address of the second connection
-
<technology1> with connection type (technology) of the first connection
-
<technology2> with connection type (technology) of the second connection
Example:
Add-Connection -Address <SQL Server instance name>,<hostname> -Technology sqlserver,windows -Enabled -PassThru -LinkHost
Change the authentication used to monitor a Spotlight connection
Supply User / Password details
Get-Connection -Name connectionName | Set-Connection -Credential $(get-credential)
Change to Windows authentication (using Diagnostic Server credentials)
Get-Connection -Name connectionName | Set-Connection -UseDSAuth
Update Tag (using Diagnostic Server credentials)
Get-Connection -Name connectionName | Set-Connection -Tag tag
Disable monitoring a Spotlight connection
Get-Connection -Name connectionName | Set-Connection -Disabled
Re-enable monitoring a Spotlight connection
Get-Connection -Name connectionName | Set-Connection -Enabled
Windows Powershell / Command line parameters
-Name connectionName
Supply the name of the connection.
Connection names are not case sensitive.
-Address address
Supply the address of the Spotlight connection as per the form of the address entered in the Spotlight Client | Configure Connections | Properties | Details | Address field. For example: the Server Name, Server Instance Name, or IP address.
-Technology connectionType
Supply the connection type in Internet MIME format. For example: os/windows, os/vmware. More free form forms are accepted such as windows, vmware, hyperv, sqlserver, sqlazure, analysisservices, replication and availabilitygroups.
-Tag tag
Supply the tag of the connection, not case sensitive, input one of tags or all of the tags, no need input the # sign.
-Credential $(get-credential)
Use the -Credential parameter to specify User / Password details as per the connection type. For Add-Connection, where the -Credential parameter is not specified, Windows authentication (using Diagnostic Server credentials) is assumed.
The -Credential parameter requires a PSCredential object, which is a Powershell built-in object.
It can be used via a temporary variable (preferable if you want to add many connections) as per:
$c = $(get-credential)
Add-Connection -Credential $c -Technology sqlserver -Address my.host.name\instance -Enabled
It can be used inline as per:
Add-Connection -Credential $(get-credential) -Technology sqlserver -Address my.host.name\instance -Enabled
-Enabled
Enable Spotlight monitoring on this connection.
-Disabled
Disable Spotlight monitoring on this connection.
Add a list of connections
Add a list of connections where all connections are of the same technology / connection type. Separate each address with a comma. Supply one technology type.
Add-Connection -Address address1,address2,address3 -Technology connectionType -Tag tag -Enabled -PassThru
Add a list of connections where there are varying connection types. Separate each address with a comma. Provide a list of technology types where the first address corresponds to the first technology type, the second address corresponds to the second technology type etc.
Add-Connection -Address address1,address2,address3 -Technology connectionType1,connectionType2,connectionType3 -Enabled -PassThru
Remove many connections
Remove all connections
Remove-Connection -Name *
Remove all connections of a specific type (technology)
Remove-Connection -Technology connectionType
For example to remove all connections where the connection type is SQL Server:
Remove-Connection -Technology sqlserver
Remove a list of connections. Type the name of each connection. Separate each connection name with a comma.
Remove-Connection -Name connectionName1,connectionName2,connectionName3
Remove a list of connections where the connection names form a pattern.
Remove-Connection -Name connectionName*
For example to remove all connections where the name begins with the characters “address”:
Remove-Connection -Name address*