• Microsoft SQL Server

    Check if Analysis Services generate any memory dump with Powershell

    Sometime , Analysis services engine terminates unexpectedly with an internal error when unexpected exception occurred. In this case, you could find in the log directory various mini memory dump.

    It is recommended to contact Microsoft Support to help on the analysis of the dump to identify the root cause of the problem

     

    $serverName = "serverName"
    $instanceNameOLAP = 'mySSAS_InstanceName'
     
    # Get the internal OLAP instance Name 
    $InternalInstanceName=(get-itemproperty -path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\OLAP").$instanceNameOLAP

    # Get the registry path where dumpDir is located 
    $keyName="HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\"+$InternalInstanceName+"\CPE"

    # Get the value of ErrorDumpDir key
    $serverLogFolder=$(Get-ItemProperty $keyName).ErrorDumpDir

    # Lists the objects stored in this folder where the extension is .mdmp.
    $dump = dir $serverLogFolder | ?{$_.name -match “^*.mdmp$”}

    foreach ($b in $dump | SELECT LastWriteTime,Name)
    {
        write-host 'Found memory dump inside '$serverLogFolder
        break;
    }

    $dump | SELECT LastWriteTime,Name, Length

     

    Script updated  9th April 2012.

     

    Michel Degremont | Premier Field Engineer - SQL Server Core Engineer |

  • Microsoft SQL Server

    Get Analysis Services properties that are no longer in default Powershell

    You could find below a sample a script powershell to see which property is no default value of Analysis Services:

     

    $serverName = "serverName\SQL2008_InstanceName"

    # Load the AMO assembly in Powershell
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")

    # Create a server object
    $serverAS = New-Object Microsoft.AnalysisServices.Server

    # Connect to your Analysis Services server
    $serverAS.connect($serverName)

    # Creation of my dataset to store my result
    $myDS = new-object System.Data.DataSet
    $myDS.Tables.Add("myDS")
    $myDS.Tables["myDS"].Columns.Add("name",[string])| out-null
    $myDS.Tables["myDS"].Columns.Add("value",[string])| out-null
    $myDS.Tables["myDS"].Columns.Add("defaultvalue",[string])| out-null

    # Browsing all properties to see which one has been changed  
    foreach($b in $serverAS.ServerProperties | SELECT name,value,defaultvalue )
    {
        # Check if the current value is different from the default value
        if ($b.value -ne $b.defaultvalue)
        {       
       
            # Add a new row to my Data Set
            $dr = $myDS.Tables["myDS"].NewRow()
           
            # Fill the cells
            $dr["name"] =  $b.name;
            $dr["value"] = $b.value.ToString();
            $dr["defaultvalue"] = $b.defaultvalue;
           
            $myDS.Tables["myDS"].Rows.Add($dr)

        }

    }

    # Query the result
    $myDS.Tables["myDS"] | SELECT  name,value,defaultvalue;

     

    Michel Degremont | Premier Field Engineer - SQL Server Core Engineer |

  • Microsoft SQL Server

    Get SSAS version with Powershell and AMO


    I will try to illustrate how to get various information about Analysis Services by using powershell.

    You could find below the first script to make the first connection:

     

    $serverName = "serverName\SQL2008_InstanceName"

    # Load the AMO assembly in Powershell
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")

    # Create a server object :
    $serverAS = New-Object Microsoft.AnalysisServices.Server

    # Connect to your Analysis Services server
    $serverAS.connect($serverName)

    # Select the information
    $serverAS | SELECT  Name,Edition,Version

     

    Michel Degremont | Premier Field Engineer - SQL Server Core Engineer |

     


     

Page 1 of 1 (3 items)