• Hi MickyD

    Just modify your getStartupParameters function, and it works as a charm on all versions.

    ####################################### Mathias FATENE : New code###########################

    # 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)

    {

    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")

    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement")

    $server =$pHostName

    $SQLServices = Get-WmiObject -ComputerName $server -Class win32_service -Filter "State='Running'" | where {($_.name -like "MSSQL$*" -and $_.name -like "*") -or $_.name -eq "MSSQLSERVER"}

    $wmiserver = New-Object "Microsoft.SqlServer.Management.Smo.WMI.ManagedComputer" $server

    foreach($sqlServer in $SQLServices) {

    $servicename="MSSQL$"+$pInstanceName

    $servicename=$servicename -replace (' ',"")

    if ('MSSQL$'+"$pInstanceName" -eq $sqlServer.Name)

    {

    $startupParameters = $wmiserver.Services[$sqlServer.Name].StartupParameters

    $startupParameters

    }

    }

    return $startupParameters

    }

    ####################################### Mathias FATENE ###########################