## PowerShell Examples
##### Add user to all workspaces with a select name
```powershell
$UserEmail = "
[email protected]"
$AccessType = "Admin"
$WorkspaceNameSearch = "cust-*"
Connect-PowerBIServiceAccount
Get-PowerBIWorkspace -Scope Organization -WarningAction Ignore -All |
`Where-Object {
$_.State -eq "Active" -and $_.Type -eq "Workspace" -and $_.Name -like $WorkspaceNameSearch
} |
` ForEach-Object {
$Workspace = $_
Add-PowerBIWorkspaceUser -Scope Organization -WarningAction Ignore `
-Id $Workspace.Id `
-UserPrincipalName $UserEmail `
-AccessRight $AccessType
Write-Host "Loaded Workspace and added user ($UserEmail) to Workspace = $($Workspace.Name), ID = $($Workspace.ID)"
}
```