I downloaded Powerbi 32 bit
and 64 bit
msi files from https://powerbi.microsoft.com/en-us/downloads/
and created below script .
$ScriptDir = (Split-Path $MyInvocation.MyCommand.Path)
$MSIArguments = @(
"/i"
"$ScriptDir\PBIDesktop.msi"
"/qn"
# "/norestart"
"ACCEPT_EULA=1"
)
$MSIArguments2 = @(
"/i"
"$ScriptDir\PBIDesktop_x64.msi"
"/qn"
# "/norestart"
"ACCEPT_EULA=1"
)
$architecture=gwmi win32_processor | select -first 1 | select addresswidth
if ($architecture.addresswidth -eq "64"){
Start-Process "msiexec.exe" -ArgumentList $MSIArguments2 -wait
}
elseif ($architecture.addresswidth -eq "32"){
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -wait
}
$ScriptDir
Script works perfectly only if the source directory/$ScriptDir
does not have spaces in between.
for example if source directory is c:/test
or c:/test_test/test
it works perfectly.
But if the source directory/$ScriptDir
has spaces, it hangs with msi option error given below
for example if source directory/$ScriptDir
is C:\Users\Dell\Desktop\New folder
powershell script hangs at above message
.. yet no installation .
i have added echo at the end of the script to find the path $ScriptDir
and it gives below echo result which makes me more confusing.
C:\Users\Dell\Desktop\New folder
Not sure why msiexec.exe cant run arguments when there is a space .
Please help me to fiugre out What could be the reason ? how could this be fixed to run even if $ScriptDir is having spaces ?