mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
33 lines
791 B
PowerShell
33 lines
791 B
PowerShell
<#
|
|
.SYNOPSIS
|
|
Closes a open connection to a MSSQL server
|
|
.DESCRIPTION
|
|
This Cmdlet will close an open connection to a MSSQL server.
|
|
.FUNCTIONALITY
|
|
Closes an open connection to a MSSQL server.
|
|
.EXAMPLE
|
|
PS>Close-IcingaMSSQLConnection $OpenMSSQLConnection;
|
|
.INPUTS
|
|
System.Data.SqlClient.SqlConnection
|
|
.OUTPUTS
|
|
.LINK
|
|
https://github.com/Icinga/icinga-powershell-framework
|
|
#>
|
|
function Close-IcingaMSSQLConnection()
|
|
{
|
|
param (
|
|
[System.Data.SqlClient.SqlConnection]$SqlConnection = $null
|
|
);
|
|
|
|
if ($null -eq $SqlConnection) {
|
|
return;
|
|
}
|
|
|
|
Write-IcingaDebugMessage `
|
|
-Message 'Closing client connection for endpoint {0}' `
|
|
-Objects $SqlConnection;
|
|
|
|
$SqlConnection.Close();
|
|
$SqlConnection.Dispose();
|
|
$SqlConnection = $null;
|
|
}
|