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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Rohitb
Helper I
Helper I

Open "PowerBI" Desktop using PowerShell

Hello,

I have a requirement where I have to open PowerBI Desktop Application via PowerShell & also open a PBIX File using PowerShell.

Can someone help me with this ?

2 ACCEPTED SOLUTIONS
v-xiaocliu-msft
Community Support
Community Support

Hi @Rohitb ,

 

At my knowledge, we can get path of the .pbix file and open power bi desktop with the .pbix file using powershell.

 

Sample:

$PowerBIFilePath = "C:\*** "

Start-Process -FilePath $PowerBIFilePath

 

Best Regards,

Wearsky

View solution in original post

This PowerShell code opens your Power BI and then saves your PBIX file as a PBIT.
You need to change lines two and three in this code according to your path.

ahadkarimi_1-1723396066882.png

 


ahadkarimi_2-1723396348173.png

 


Add-Type -AssemblyName System.Windows.Forms
$powerBIPath = "C:\Program Files\Microsoft Power BI Desktop RS\bin\PBIDesktop.exe"
$filePath = "C:\Users\Ahadk\OneDrive\Desktop\Working.pbix"

Start-Process $powerBIPath -ArgumentList $filePath
Start-Sleep -Seconds 30
[System.Windows.Forms.SendKeys]::SendWait('%')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('F')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 0.5
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")

View solution in original post

8 REPLIES 8
ahadkarimi
Solution Specialist
Solution Specialist

Open PowerShell:

ahadkarimi_0-1723388404350.png

Place PBIDesktop file path between double quotes, like this:

Start-Process -FilePath "C:\Program Files\Microsoft Power BI Desktop RS\bin\PBIDesktop.exe"

ahadkarimi_4-1723388791727.png

 

ahadkarimi_1-1723388431787.png

for PBIX files:
Place your file path between double quotes, like this:

Start-Process -FilePath "C:\Users\Ahadk\OneDrive\Desktop\test.pbix"

ahadkarimi_3-1723388569010.png

 

 

Hey @ahadkarimi 

Opening the pbix was already stated by @v-xiaocliu-msft . 

The next ask from the user is to save the opened file as another format. 

 




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

This PowerShell code opens your Power BI and then saves your PBIX file as a PBIT.
You need to change lines two and three in this code according to your path.

ahadkarimi_1-1723396066882.png

 


ahadkarimi_2-1723396348173.png

 


Add-Type -AssemblyName System.Windows.Forms
$powerBIPath = "C:\Program Files\Microsoft Power BI Desktop RS\bin\PBIDesktop.exe"
$filePath = "C:\Users\Ahadk\OneDrive\Desktop\Working.pbix"

Start-Process $powerBIPath -ArgumentList $filePath
Start-Sleep -Seconds 30
[System.Windows.Forms.SendKeys]::SendWait('%')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('F')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 0.5
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait('{DOWN}')
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
v-xiaocliu-msft
Community Support
Community Support

Hi @Rohitb ,

 

At my knowledge, we can get path of the .pbix file and open power bi desktop with the .pbix file using powershell.

 

Sample:

$PowerBIFilePath = "C:\*** "

Start-Process -FilePath $PowerBIFilePath

 

Best Regards,

Wearsky

Thankyou for your response @v-xiaocliu-msft .

How do I save the PowerBI File as PBIT/PBIP using PowerShell ?

Hi @Rohitb ,

 

I'm afraid that this requirement cannot be easily implemented with PowerShell. This may require programming experience with PowerShell and .NET. As a simple workaround, please try Power Automate Desktop.

Sample:

vxiaocliumsft_0-1722922456789.png

vxiaocliumsft_0-1722922490157.png

You can record your operation steps, such as saving, etc…

 

Best Regards,

Wearsky

@v-xiaocliu-msft  Thankyou for your response.

I have already explored Power Automate way but we want to explore via PowerShell/Python/.Net

Can you please help with either of the 3 coding language ?

I am not sure whether this is even possible because based on MSFT documentation; the only was is for it to be done manually




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.