Databases Reference
In-Depth Information
$strKeyPath
=
"SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL.$instanceNo\MSSQLServer\SuperSocketNetLib\Np"
$intEnabled
=
$reg.GetDWORDValue($HKEY_LOCAL_MACHINE,
$strKeyPath,"Enabled").uvalue
if ($intEnabled -eq 1) { $strProtocols
=
$strProtocols
+
'np,' }
$strKeyPath
=
"SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL.$instanceNo\MSSQLServer\SuperSocketNetLib\Sm"
$intEnabled
=
$reg.GetDWORDValue($HKEY_LOCAL_MACHINE,
$strKeyPath,"Enabled").uvalue
if ($intEnabled -eq 1) { $strProtocols
=
$strProtocols
+
'sm,' }
$strKeyPath
=
"SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL.$instanceNo\MSSQLServer\SuperSocketNetLib\Via"
$intEnabled
=
$reg.GetDWORDValue($HKEY_LOCAL_MACHINE,
$strKeyPath,"Enabled").uvalue
if ($intEnabled -eq 1) { $strProtocols
=
$strProtocols
+
'via,' }
return $strProtocols.Substring(0, $strProtocols.Length-1)
}
}
}
# This function connects to the HKLM registry hive of the SQL Server host $pHostName
# and retrieve the startup parameters used by the instance $pInstanceName.
function getStartupParameters([String] $pHostName, [String] $pInstanceName)
{
$reg
=
[WMIClass]"\\$pHostName\root\default:stdRegProv"
$HKEY_LOCAL_MACHINE
=
2147483650
$strKeyPath
=
"$instanceRegPath\Parameters"
$arrValues
=
$reg.EnumValues($HKEY_LOCAL_MACHINE,$strKeyPath).sNames
#SQL Server 2000
if ($arrValues) {
for ($i
=
0; $i -lt $arrValues.Length; $i
++
){
$strParameters
=
$strParameters
+
$reg.GetStringValue($HKEY_LOCAL_MACHINE,$strKeyPath,$arrValues[$i]).svalue
+
";"
}
return $strParameters
}
#SQL Server 2005
for ($i
=
1; $i -le 50; $i
++
){
$strKeyPath
=
"SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.$i"
$strInstanceName
=
$reg.GetStringValue($HKEY_LOCAL_MACHINE,
$strKeyPath,"").svalue
if ($strInstanceName -eq $pInstanceName) {
$strKeyPath
=
"SOFTWARE\Microsoft\Microsoft SQL
Server\MSSQL.$i\MSSQLServer\Parameters"
$arrValues
=
$reg.EnumValues($HKEY_LOCAL_MACHINE,
$strKeyPath).sNames
Search WWH ::
Custom Search