New-SqlMonitorSqlServer
Published 21 March 2023
Creates a new temporary object that holds information about a SQL Server instance.
Syntax
New-SqlMonitorSqlServer [-FullName] <string> [-BaseMonitor] <BaseMonitor> [[-Alias] <string>] [[-SqlServerAuthenticationMode] <string>] [[-UserName] <string>] [[-Password] <string>] [[-NetworkProtocol] <string>] [[-Port] <int>] [[-PacketSize] <int>] [[-ConnectionTimeout] <int>] [[-ExecutionTimeout] <int>] [[-EncryptConnection] <bool>] [[-TrustServerCertificate] <bool>] [<CommonParameters>]
Description
The New-SqlMonitorSqlServer cmdlet creates a new temporary object that holds information about a SQL Server instance. The returned object needs to be passed to Add-SqlMonitorMonitoredObject together with a host info, as it does not add anything to SQL Monitor on its own.
Parameters
  
    -FullName
    <String>
  
The full address of the SQL Server instance to be monitored, e.g. "localhost" or "localhost\sql2022".
| Aliases | None | 
| Required? | true | 
| Position? | 1 | 
| Default Value | None | 
| Accept Pipeline Input | True (ByValue) | 
| Accept Wildcard Characters | false | 
  
    -BaseMonitor
    <BaseMonitor>
  
The base monitor to add the monitored object to. For more informatiom, see https://documentation.red-gate.com/sm/api/powershell-cmdlet-reference/get-sqlmonitorbasemonitor.
| Aliases | None | 
| Required? | true | 
| Position? | 2 | 
| Default Value | None | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -Alias
    <String>
  
Alias (display name)
| Aliases | None | 
| Required? | false | 
| Position? | 3 | 
| Default Value | None | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -SqlServerAuthenticationMode
    <String>
  
"windows" or "sqlServer" or "inherit", the last option uses the credentials supplied for Windows username/password or Base Monitor Service credentials.
| Aliases | None | 
| Required? | false | 
| Position? | 4 | 
| Default Value | Inherit | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -UserName
    <String>
  
SQL login username to connect to SQL Server instance with.
| Aliases | None | 
| Required? | false | 
| Position? | 5 | 
| Default Value | None | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -Password
    <String>
  
SQL login password to connect to SQL Server instance with.
| Aliases | None | 
| Required? | false | 
| Position? | 6 | 
| Default Value | None | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -NetworkProtocol
    <String>
  
SQL Network Protocol. Valid values are 'default', 'sharedMemory', 'namedPipes' and 'tcpip'.
| Aliases | None | 
| Required? | false | 
| Position? | 7 | 
| Default Value | None | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -Port
    <Int32>
  
SQL Server port number.
| Aliases | None | 
| Required? | false | 
| Position? | 8 | 
| Default Value | 0 | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -PacketSize
    <Int32>
  
Packet size.
| Aliases | None | 
| Required? | false | 
| Position? | 9 | 
| Default Value | 0 | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -ConnectionTimeout
    <Int32>
  
Connection time-out.
| Aliases | None | 
| Required? | false | 
| Position? | 10 | 
| Default Value | 0 | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -ExecutionTimeout
    <Int32>
  
Execution time-out.
| Aliases | None | 
| Required? | false | 
| Position? | 11 | 
| Default Value | 0 | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -EncryptConnection
    <Boolean>
  
Encrypt connection.
| Aliases | None | 
| Required? | false | 
| Position? | 12 | 
| Default Value | False | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -TrustServerCertificate
    <Boolean>
  
Trust server certificate
| Aliases | None | 
| Required? | false | 
| Position? | 13 | 
| Default Value | False | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  
    -ProgressAction
    <ActionPreference>
  
{{ Fill ProgressAction Description }}
| Aliases | None | 
| Required? | false | 
| Position? | named | 
| Default Value | None | 
| Accept Pipeline Input | False | 
| Accept Wildcard Characters | false | 
  <CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see http://technet.microsoft.com/en-us/library/hh847884.aspx.
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
- 
    None.
    
 You cannot pipe input to this cmdlet.
Examples
-------------------------- EXAMPLE 1 --------------------------
$instance = New-SqlMonitorSqlServer -FullName "localhost" -BaseMonitor $BaseMonitor -UserName "sql_username" -Password "sql_pass" $server = New-SqlMonitorLinuxHost -HostName "localhost" -BaseMonitor $BaseMonitor -SshUserName "ssh_user" -SshPassword "ssh_pass" $server, $instance | Add-SqlMonitorMonitoredObject
-------------------------- EXAMPLE 2 --------------------------
$instance = New-SqlMonitorSqlServer -FullName "localhost" -BaseMonitor $BaseMonitor -UserName "sql_username" -Password "sql_pass" -SqlServerAuthenticationMode "sqlserver" -SqlServerPort 5122 $server = New-SqlMonitorWindowsHost -HostName "localhost" -BaseMonitor $BaseMonitor -WindowsUserName "win_username" -WindowsPassword "win_pass" $server, $instance | Add-SqlMonitorMonitoredObject