Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
Have some powershell code to give us inventory of workspace and reports and run this in powershell.
Is it possibe to run powershell scripts directly in servicedesktop without having to run manually like this?
Thanks
Hi @po,
You have to execute your PowerShell scripts from the IDE when developing or testing things out. Export it to a .CSV or table in a database, and go from there.
Reza Rad at RADACAD.com has a nice write-up of how to set this up, with decent intermediate explanations of the entire thing.
I strongly suggest you read, and try this approach.
When your script is finished, you can use things like Task Scheduler to automate this process. Here is a blog with info on how you can do that.
Hi,
Thanks for update.
Have ran online to get inventory and works online.
Can now look to scedule.
However, we are currently using
Login-PowerBI
and notice radacad uses get credentials but both involve online entry which won't be possible when schedule.
How can we pass username and password and login to power vbi via script without pop-up box?
Thanks
Hi @po,
I use the snippet below in my own Audit Logs script, and pass to Task Scheduler. Make sure you use an app password from O365, to avoid having to deal with MFA.
##This is better for scheduled jobs
$User = "user@domain.com"
$PWord = ConvertTo-SecureString -String "apppasswordhere" -AsPlainText -Force
$UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PWord
###This will prompt the user for credential
#$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 44 | |
| 16 | |
| 15 |