I am trying to remove tap driver through Custom action using powershell script. Script runs successfully when executing it directly, however it fails when it is executed through Custom action in installer.
Script:
Code: Select all
function removeTapDriver()
{
$tapDriverName = "TAP Driver Windows"
$tapDriver = Get-Package $tapDriverName
if($tapDriver -ne $null)
{
Uninstall-Package -Name $tapDriverName -Force
}
}
removeTapDriver
Execution stage: Remove resources
Execution time: When the system is being modified (deferred)
Execution options: Run under the LocalSystem account with full privileges (no impersonation)
Execution policy: Bypass
Scrip is run as admin
Output:
Code: Select all
Uninstall-Package : Uninstallation operation failed. Please look at
'msi.log' file for details.
At scrD3C3.ps1:10 char:9
+ Uninstall-Package -Name $tapDriverName -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({F4A3C37C-4D08-4D6F-AAEA-35980C773582}:String) [Uninstall-Package], E
xception
+ FullyQualifiedErrorId : Uninstallation operation failed. Please look at '{0}' file for details.,Microsoft.PowerS
hell.PackageManagement.Cmdlets.UninstallPackage
FOLLOW US
Get the latest news in Application Packaging