@Priya Jha You need to call the tabular object model directly from Powershell scripts. Please find below script which will give the roles and members of a Model.
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$ServerName = "asazure://westus.asazure.windows.net/abc:rw"
$DB = "adventureworks"
$MyServer = New-Object Microsoft.AnalysisServices.Server
$MyServer.Connect($ServerName)
$myDatabase = $myServer.Databases.Item($DB)
foreach ( $roles in $myDatabase.Model.Roles) {
#Write-Output $roles.Name
foreach ( $role in $roles) {
Write-Output $role.Name
Write-Output "----------------------"
foreach ( $member in $roles.Members) {
"Member Name: " + $member.Name
}
Write-Output "`n"
}
}
Output:
Model as appears on SSMS:
----------
Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.