Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
po
Post Prodigy
Post Prodigy

using powershell within service possible?

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

3 REPLIES 3
Anonymous
Not applicable

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

Anonymous
Not applicable

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

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.