zverev-iv@linux-server:~$ klist
Ticket cache: FILE:/tmp/krb5cc_*************
Default principal: zverev-iv@COMPANY.LOCAL
Valid starting Expires Service principal
11/16/2022 20:40:40 11/17/2022 06:40:40 krbtgt/COMPANY.LOCAL@COMPANY.LOCAL
renew until 11/23/2022 20:40:40
zverev-iv@linux-server:~$ cat mssql/connect-to-mssql.ps1
Write-Output "Q: Is Linux? A: $($IsLinux)"
$sqlConn = New-Object System.Data.SqlClient.SqlConnection
$sqlConn.ConnectionString = "Data Source=sql.COMPANY.LOCAL;Initial Catalog=master;Integrated Security=True"
$sqlConn.Open()
$sqlcmd = $sqlConn.CreateCommand()
$sqlcmd.CommandText = "SELECT @@VERSION"
$adp = New-Object System.Data.SqlClient.SqlDataAdapter $sqlcmd
$data = New-Object System.Data.DataSet
$adp.Fill($data) | Out-Null
$data.Tables
zverev-iv@linux-server:~$ pwsh mssql/connect-to-mssql.ps1
Q: Is Linux? A: True
Column1
-------
Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64) …
zverev-iv@linux-server:~$