Share via


PowerShell:How to List Database Roles and their Members

    1:  [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
    2:  $ServerName = ".\sql2008r2"
    3:  $DB = "Adventure Works DW 2008"
    4:  $Server = New-Object Microsoft.AnalysisServices.Server
    5:  $Server.Connect($ServerName)
    6:  $SSASDatabase = $Server.Databases.Item($DB)
    7:  $SSASDatabase.Roles | Select Name, Members