HPE Morpheus VM Essentials
1824976 Members
3750 Online
109678 Solutions
New Discussion

Automation | virtIO Install after OS installation

 
pmfna44
Occasional Advisor

Automation | virtIO Install after OS installation

Hi all,

any way to use automation to launch a powershell script to install virtIO Drivers after Windows OS Install?

it seems we can, but the documentation is lacking some examples, and the interface for automation is a little bit confusing on what options to choose to achieve this.

 

regards

6 REPLIES 6
PSPrakash
HPE Pro

Re: Automation | virtIO Install after OS installation

Hello

From Library > Automation , You may add a new Task , Select the Type as PowerShell , Write the script to install the Driver .
While provisioning instance, In the automation selection  , you may select the "Task" you created in above step. 

 



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
pmfna44
Occasional Advisor

Re: Automation | virtIO Install after OS installation

hello,

 

thanks for your answer.

 

I'm trying to run the following script, but it fails when using automation, but if I run it on the machine directly on the powershell it runs and installs the virtio drivers.

There are several options to run the ps script one of them (Source) is confusing, i've choose local, but the script fails everytime. Tried to change execute target also, but still fails.

 

# Requires Administrator privileges
# This script assumes the virtio-win.iso is mounted as a CD/DVD drive in the VM.

# --- Configuration ---
$VirtIOIsoDriveLetter = Get-WmiObject -Class Win32_CDROMDrive | Where-Object {$_.VolumeName -like "*virtio-win*"} | Select-Object -ExpandProperty Drive

$VirtIOInstallerPath = "$VirtIOIsoDriveLetter\virtio-win-gt-x64.msi" # Adjust if the executable name is different
$LogFile = "C:\Temp\VirtIO_Installation_Log.txt" # Log file for installation output

# Create Temp directory if it doesn't exist
If (-not (Test-Path "C:\Temp")) {
    New-Item -Path "C:\Temp" -ItemType Directory | Out-Null
}

Write-Host "Starting VirtIO driver installation..."
Write-Host "VirtIO ISO found at drive: $($VirtIOIsoDriveLetter)"

# --- Install VirtIO Guest Tools ---
Write-Host "Attempting to install VirtIO Guest Tools..."
try {
    msiexec /i $VirtIOInstallerPath /qn /passive | Out-File $LogFile -Append
    Write-Host "VirtIO Guest Tools installation initiated. Check log file for details: $LogFile"
}
catch {
    Write-Error "Failed to start VirtIO Guest Tools installer. Error: $($_.Exception.Message)"
    Write-Host "Please ensure the path '$VirtIOInstallerPath' is correct and the executable exists on the mounted ISO."
    Exit 1
}

# --- Verify Installation (Optional, but recommended) ---
Write-Host "Verifying VirtIO driver installation..."
Start-Sleep -Seconds 30 # Give some time for drivers to settle

# Check for VirtIO devices in Device Manager
$VirtIODrivers = Get-PnpDevice -Class "System" | Where-Object { $_.FriendlyName -like "*VirtIO*" }
$NetworkVirtIO = Get-PnpDevice -Class "Net" | Where-Object { $_.FriendlyName -like "*VirtIO*" }
$StorageVirtIO = Get-PnpDevice -Class "SCSIAdapter" | Where-Object { $_.FriendlyName -like "*VirtIO*" }

if ($VirtIODrivers.Count -gt 0 -or $NetworkVirtIO.Count -gt 0 -or $StorageVirtIO.Count -gt 0) {
    Write-Host "VirtIO drivers appear to be installed successfully."
    Write-Host "Discovered VirtIO devices:"
    $VirtIODrivers | Select-Object FriendlyName, Status | Format-Table
    $NetworkVirtIO | Select-Object FriendlyName, Status | Format-Table
    $StorageVirtIO | Select-Object FriendlyName, Status | Format-Table
} else {
    Write-Warning "No VirtIO devices found after installation. Manual verification or troubleshooting may be required."
}

Write-Host "Installation script completed."
Write-Host "A system restart may be required for all drivers to take full effect."
 
PSPrakash
HPE Pro

Re: Automation | virtIO Install after OS installation

Hello 

Hope you had clicked on the check-box which allow to run the script with elevated privileges.

 

Capture12.JPG



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
pmfna44
Occasional Advisor

Re: Automation | virtIO Install after OS installation

hello,

 

yes I've tried that option with no success when installing the vm

pmfna44
Occasional Advisor

Re: Automation | virtIO Install after OS installation

can you specify an example with screenshots please?

MikkelAndreasen
Occasional Contributor

Re: Automation | virtIO Install after OS installation

i would suggest enabling MSI logging to see if something goes wrong during that process
msiexec /$VirtIOInstallerPath /qn /passive /l*v "c:\temp\virtio.log"

/mikkel