Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi All,
I have a list of workspaces and user names in one csv file and i need to remove that individual users from the workspace who are in that excel file. Remove in Power BI service taking time. So by using that CSV file i need to remove multiple users using PowerShell script. If it is possible please share the sctipt. Thanks in advance!
Solved! Go to Solution.
Hi @Anonymous ,
You can get the respective WorkspaceID as decribed here:
PowerShell Gallery | functions/Get-Workspace.ps1 0.2.0
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
Hi @Anonymous,
Yes, it is possible to use a PowerShell script to remove multiple users from a Power BI workspace. To do this, you can use the Remove-PowerBIWorkspaceUser cmdlet, which is part of the Power BI PowerShell module.
Here is an example of a script that you can use to remove multiple users from a PowerBI workspace using a CSV file:
# Import the Power BI module
Import-Module -Name MicrosoftPowerBIMgmt # Connect to Power BI Connect-PowerBI # Set the path to the CSV file containing the list of workspaces and user names $csvFilePath = "C:\path\to\file.csv" # Read the CSV file into a variable $users = Import-Csv -Path $csvFilePath # Loop through the rows in the CSV file foreach ($user in $users) { # Get the workspace ID and user name from the current row $workspaceId = $user.WorkspaceId $userName = $user.UserName # Remove the user from the workspace Remove-PowerBIWorkspaceUser -WorkspaceId $workspaceId -UserName $userName }
In this script, the CSV file is assumed to have two columns: "WorkspaceId" and "UserName". The script reads the CSV file into a variable, and then loops through the rows in the file, extracting the workspace ID and user name for each row. The Remove-PowerBIWorkspaceUser cmdlet is then called for each row, passing in the workspace ID and user name as arguments, to remove the user from the workspace.
Let me know if this works 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
Hi @tackytechtom,
Thanks for the response! I ran above Power shell script and its working fine but my workaround will be CSV file that contain Workspace Name instead of Workspave ID and users name. Is it possible to remove users with the above script that contains workspace name and users name in the csv file.
Hi @Anonymous ,
You can get the respective WorkspaceID as decribed here:
PowerShell Gallery | functions/Get-Workspace.ps1 0.2.0
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
54 | |
34 | |
27 | |
26 | |
26 |
User | Count |
---|---|
62 | |
51 | |
30 | |
24 | |
23 |