WindowsBox.VMGuestTools.psm1
<# .Synopsis Install VM Guest Tools .Description This cmdlet installs VM Guest tools for VirtualBox from a mounted CD #> function Install-VMGuestTools { [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "")] param() $installed = $false foreach ($drive in Get-PSDrive -PSProvider 'FileSystem') { $setup = "$($drive.Root)VBoxWindowsAdditions.exe" $cert = "$($drive.Root)cert\oracle-vbox.cer" if ((Test-Path $setup) -and (Test-Path $cert)) { certutil -addstore -f 'TrustedPublisher' $cert mkdir 'C:\Windows\Temp\virtualbox' -ErrorAction SilentlyContinue Start-Process -FilePath $setup -ArgumentList '/S' -WorkingDirectory 'C:\Windows\Temp\virtualbox' -Wait Remove-Item C:\Windows\Temp\virtualbox -Recurse -Force $installed = $true } } if (!$installed) { Write-Error "Guest additions were not installed, did you forget to mount the ISO?" } } |