Remove Active Setup

From psadt | Evergreen Application Management
Jump to navigation Jump to search

About

Powershell.png

PowerShell function to remove an Active Setup we created previously (see Create Active Setup).

Note:

  • $appName is the name of your given application
  • $appGUID is the unique GUID for your application (this can be whatever you like)


Function

#region Function Remove-ActiveSetup
Function Remove-ActiveSetup {
<#
.SYNOPSIS
	Removes Active Setup.
.DESCRIPTION
.PARAMETER
.LINK
	http://psadt.com/
#>

Begin	{
	$ActiveSetupPath = "$env:ProgramData\ActiveSetup\$appName"
	$ActiveSetupConfig = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\$appGUID"
	If (Test-Path $ActiveSetupPath)
		{Remove-Item $ActiveSetupPath -Recurse -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue}
	If (Test-Path $ActiveSetupConfig)
		{Remove-Item $ActiveSetupConfig -Recurse -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue}
	}
}

#endregion