Obtener propiedades de Analysis Services que ya no están por defecto en Powershell

A continuación, encontrará un script de ejemplo en las propiedades de PowerShell para ver los valores que ya no están en Analysis Services por defecto:

 

$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 |