Auto install of PowerBI

Having recently been having rebuilding my machine I finally decided to automate the process of installing the software I need.

This was a life saver as I was reinstalling a few times to try and figure out why I wasn’t getting sound on my external monitor. So I was gradually uninstalling everything until I found out that it was Hyper-v that was causing the problem.

The outcome meant I was installing PowerBI lots and had to automate it.

The answer was a few simple bits of powershell, that checks, I really should turn this into a powershell DSC definition, that will be next.

I believe this will work moving forward as they release new versions. I’ve been told the fwLink will point to the current version. Time will tell

 

$PBIExe = "C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe"

$install = $false

$PBIConfig = Download-Json "http://download.microsoft.com/download/9/B/A/9BAEFFEF-1A68-4102-8CDF-5D28BFFE6A61/PBIDesignerConfig.json"

   

if (test-path $PBIExe) {

    $installedVersion = [version]$(gi $PBIExe).VersionInfo.FileVersion

 

    $currentVersion = [version]$($PBIConfig.release.x64 | where {$_.key -eq "ClientUpdateVersion"}).value

    if ($currentVersion.Major -gt $installedVersion.Major -or$currentVersion.Minor -gt $installedVersion.Minor -or $currentVersion.Build -gt $installedVersion.Build) {$install=$true}

}

else{$install=$true}

 

if ($install){

    $msiPath = "$env:temp\PowerBI.msi"

  

    $download=$true

    if (test-path $msiPath ){

        #Code to check if one needs to download the msi

    }

 

    if ($download){Download-File 'http://go.microsoft.com/fwlink/?LinkID=521662' $msiPath}

   

    msiexec /i $msiPath ACCEPT_EULA=1 /passive }

 

This uses two functions Download-File and Download-Json

 

function Download-Json {

param ([string] $url)

  $downloader = new-object System.Net.WebClient

  , $downloader.DownloadString($url) |ConvertFrom-Json

}

 

function Download-File {

param ([string] $url, [string] $file)

  $downloader = new-object System.Net.WebClient

  , $downloader.DownloadFile($url, $file)

}

Published Thursday, March 17, 2016 6:03 PM by simonsabin
Filed under: ,

Comments

Friday, March 18, 2016 12:07 PM by Power BI Auto-Installation – Curated SQL

# Power BI Auto-Installation – Curated SQL

Pingback from  Power BI Auto-Installation – Curated SQL