title: how to view ssas analysis services roles using nodejs
body: <p>how to view SSAS analysis services roles and assign that roles to related users
  using programming languages like <strong>nodejs</strong>
  I have tried PowerShell code but i dont know how to assign roles;just i saw roles</p>
  <pre><code>$SourceInstance = &quot;SERVER\Node&quot;
  $RoleName = &quot;BUSINESSROLE&quot;
  $Username = &quot;DOMAIN\USERNAME&quot; [System.reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.AnalysisServices&quot;) | Out-Null
  $mySourceServer = new-Object Microsoft.AnalysisServices.Server
  $mySourceServer.Connect($SourceInstance)
  
  [Microsoft.AnalysisServices.Database[]] $mySourceDatabases = @()
  $mySourceDatabases = $mySourceServer.Databases
  
  foreach ($mySourceDB in $mySourceDatabases)
  {
      [Microsoft.AnalysisServices.Role]$myRole = $null
      $myRole = $mySourceDB.Roles.FindByName($RoleName)
      if($myRole -ne $null)
      {
          Write-Host &quot; $mySourceDB : &quot; -ForegroundColor Green
          foreach ($myMember in $myRole.Members)
          {
              if( $myMember.Name -contains $Username)
              {
                  Write-Host &quot;   &quot; $myMember.Name -ForegroundColor yellow
              }
          }
      }
  }
  $mySourceServer.Disconnect()
  </code></pre>