Solved

Powershell Script Install VirtIO MSI Fails

  • 16 March 2018
  • 4 replies
  • 4274 views

Badge
Has anyone successfully scripted the process of copying the Install VirtIO and executing the installer MSI ?

My goal is to have a powershell script to import the VMware VMs in our Vcenter clusters into the Nutanix cluster. I am almost got it complete but this problem with the MSI installer is something I just can't figure out.

Honestly I don't think my script has anything to do with the problem but its possible which is why I am reach out.

Testing Virtio MSI Script
I thought what if I could use my same script but push the installer to a different remote host but the same result, failed everytime. Then I attempted just to take a MSI file to verify the script does work to copy the installer and run the MSI on the remote server. Now I came to find out that was successful using the nutanixcmdlet.msi. Maybe I had an issue with the Nutanix-VirtIO-1.1.2.msi and I download a new one off the nutanix download tools section. Again I ran my script but the result was the same as before it failed with error code 1603

I continue to get error in the part of my script that runs the MSI installer due to returning a exit Error code of 1603

Thing I verified are:
PS Remoting is Enabled
WINRM running
Not using Windows Firewall disabled
Exported a certificate Trusted Publishers

The odd behavior is that when I was doing testing on the script and had issue with the adding of the VMware VM drives (now has been fixed) over to Nutanix VM a single VM out of three tested with could install the MSI.

.\InstallSoftwareRemotely.ps1 -AppPath "C:\nutanix\Nutanix-VirtIO-1.1.2.msi" -ComputerList testahv06 -Credential
icon

Best answer by gwhig12 3 April 2018, 14:11

No. I never figured out the solution but since it was the only part of the script not working I just excluded it. For my script to work I just have to manually install the VirtIO installer before running the script.

The functionality would be a great value to be able to install the VirtIO driver within the script.

I tried to adapt a script written by Steven Poitras called NTNX-Install-MSI from "GitHub" but I couldn't get the exported certificate to work which may be related to the issue.
View original

4 replies

Badge
Here is the function I currently am working with but fails with the nutanix-virtio-1.1.2.msi

code:
Function InstallRemoteSoftware([string]$Computer){
If ($Cred){
try{
Return Invoke-Command -computername $Computer -ScriptBlock {
$Application = $args[0]
$AppArgs = $args[1]
$ApplicationName = $Application.Substring($Application.LastIndexOf('\')+1)
$ApplicationFolderPath = $Application.Substring(0,$Application.LastIndexOf('\'))
$ApplicationExt = $Application.Substring($Application.LastIndexOf('.')+1)
Write-Host "Installing $($ApplicationName) on $($env:COMPUTERNAME)"
If($ApplicationExt -eq "msi"){
If ($AppArgs -ne "None"){
Write-Host "Installing as MSI: msiexec /i $($Application) $($AppArgs)"
$p = Start-Process "msiexec" -ArgumentList "/i $($Application) $($AppArgs)" -Wait -Passthru
}
else{
Write-Host "Installing as MSI: msiexec /i $($Application)"
$p = Start-Process "msiexec" -ArgumentList "/i $($Application) /quiet /norestart" -Wait -Passthru
}
}
ElseIf ($AppArgs -ne "None"){
Write-Host "Executing $Application $AppArgs"
$p = Start-Process $Application -ArgumentList $AppArgs -Wait -Passthru
}
Else{
Write-Host "Executing $Application"
$p = Start-Process $Application -Wait -Passthru
}
$p.WaitForExit()
if ($p.ExitCode -ne 0) {
Write-Host "Failed installing with error code $($p.ExitCode)" -ForegroundColor Red
$Return = $($env:COMPUTERNAME)
}
else{
$Return = 0
}
Write-Host "Deleting $($ApplicationFolderPath)"
Remove-Item $($ApplicationFolderPath) -Force -Recurse
Return $Return
} -ArgumentList "$($LocalPath)\$($ApplicationFolderName)\$($ApplicationName)", $AppArgs -Credential $Cred
}catch{throw $_.Exception}
}
else{
try{
Return Invoke-Command -computername $Computer -ScriptBlock {
$Application = $args[0]
$AppArgs = $args[1]
$ApplicationName = $Application.Substring($Application.LastIndexOf('\')+1)
$ApplicationFolderPath = $Application.Substring(0,$Application.LastIndexOf('\'))
$ApplicationExt = $Application.Substring($Application.LastIndexOf('.')+1)
Write-Host "Installing $($ApplicationName) on $($env:COMPUTERNAME)"
If($ApplicationExt -eq "msi"){
If ($AppArgs -ne "None"){
Write-Host "Installing as MSI: msiexec /i $($Application) $($AppArgs)"
$p = Start-Process "msiexec" -ArgumentList "/i $($Application) $($AppArgs)" -Wait -Passthru
}
else{
Write-Host "Installing as MSI: msiexec /i $($Application)"
$p = Start-Process "msiexec" -ArgumentList "/i $($Application) /quiet /norestart" -Wait -Passthru
}
}
ElseIf ($AppArgs -ne "None"){
Write-Host "Executing $Application $AppArgs"
$p = Start-Process $Application -ArgumentList $AppArgs -Wait -Passthru
}
Else{
Write-Host "Executing $Application"
$p = Start-Process $Application -Wait -Passthru
}
$p.WaitForExit()
if ($p.ExitCode -ne 0) {
Write-Host "Failed installing with error code $($p.ExitCode)" -ForegroundColor Red
$Return = $($env:COMPUTERNAME)
}
else{
$Return = 0
}
Write-Host "Deleting $($ApplicationFolderPath)"
Remove-Item $($ApplicationFolderPath) -Force -Recurse
Return $Return
} -ArgumentList "$($LocalPath)\$($ApplicationFolderName)\$($ApplicationName)", $AppArgs
}catch{throw $_.Exception}
}
}
Userlevel 7
Badge +35
Hi @gwhig12

I'm bumping this post back up. Hoping to get some fresh eyes on it. Were you able to work through this? Let me know - Thanks
Badge
No. I never figured out the solution but since it was the only part of the script not working I just excluded it. For my script to work I just have to manually install the VirtIO installer before running the script.

The functionality would be a great value to be able to install the VirtIO driver within the script.

I tried to adapt a script written by Steven Poitras called NTNX-Install-MSI from "GitHub" but I couldn't get the exported certificate to work which may be related to the issue.
Badge +2
I installed using

msiexec /i Nutanix-VirtIO-1.1.2.msi /qb ACCEPTEULA=yes

want to use it in a MDT automated deplyment.

Network connection might Interrupt during upgrade. This may affect remote execution from powershell?

Reply