Forum Discussion
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 ?
- Anonymous2 years ago
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 $PowerBIFilePathBest Regards,
Wearsky
- 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.
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 $filePathStart-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}")
8 Replies
- AnonymousNot applicable
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 $PowerBIFilePathBest Regards,
Wearsky
- RohitbHelper I
Thankyou for your response Anonymous .
How do I save the PowerBI File as PBIT/PBIP using PowerShell ?- AnonymousNot applicable
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:
You can record your operation steps, such as saving, etc…
Best Regards,
Wearsky
- ahadkarimiSolution Specialist
Open PowerShell:
Place PBIDesktop file path between double quotes, like this:
Start-Process -FilePath "C:\Program Files\Microsoft Power BI Desktop RS\bin\PBIDesktop.exe"
for PBIX files:
Place your file path between double quotes, like this:Start-Process -FilePath "C:\Users\Ahadk\OneDrive\Desktop\test.pbix"
- NandanHegdeSuper User
Hey ahadkarimi
Opening the pbix was already stated by Anonymous .
The next ask from the user is to save the opened file as another format.
- ahadkarimiSolution SpecialistThis 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.
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 $filePathStart-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}")