VLC Player Uninstall

Hi,
I’m looking to deploy VLC to our business. The Install works great, and the Uninstall works ok but this folder remains
C:\Program Files\VideoLAN
I’ve tried deleting this folder but for some reason it won’t delete

        ## Delete the Remaining VLC Folder
        Remove-Item -path "C:\Program Files\VideoLAN" -Recurse -Force -ErrorAction:SilentlyContinue

This is in the error log. Does anyone have any ideas? This is run under the system context so it should have permission to delete?

<![LOG[[Uninstallation] :: Delete folder [C:\Program Files\VideoLAN\] recursively...]LOG]!><time="10:17:52.0400" date="11-17-2022" component="Remove-Folder" context="NT AUTHORITY\SYSTEM" type="1" thread="9680" file="Deploy-Application.ps1">
<![LOG[[Uninstallation] :: The following error(s) took place while deleting folder(s) and file(s) recursively from path [C:\Program Files\VideoLAN\].
Error Record:
-------------At C:\Users\TestUser\VLC V3\AppDeployToolkit\AppDeployToolkitMain.ps1:3611 char:7
+ ...             Remove-Item -LiteralPath $Path -Force -Recurse -ErrorActi ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error Record:
-------------At C:\Users\TestUser\VLC V3\AppDeployToolkit\AppDeployToolkitMain.ps1:3611 char:7
+ ...             Remove-Item -LiteralPath $Path -Force -Recurse -ErrorActi ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error Record:
-------------At C:\Users\TestUser\VLC V3\AppDeployToolkit\AppDeployToolkitMain.ps1:3611 char:7
+ ...             Remove-Item -LiteralPath $Path -Force -Recurse -ErrorActi ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]LOG]!><time="10:17:53.3460" date="11-17-2022" component="Remove-Folder" context="NT AUTHORITY\SYSTEM" type="2" thread="9680" file="Deploy-Application.ps1">

You might have something “Sitting” on the folder like Windows Explorer opened to the that folder (or a sub-folder). Could be another app, too.

Also, you should be using PSADT’s Remove-Folder function instead.

This how i uninstalled it, hope it gives some help forward.

		    ## <Perform UNINSTALLATION tasks here>
                # den - msi - uninstall of all versions with an automatic wildcard * before and after display name
                    Remove-MSIApplications -Name 'VLC media player'

                # den - msi - extra remove
                    Execute-MSI -Action Uninstall -Path '{5C081C2A-82EE-44F4-A379-DEC9154CEE90}' -ContinueOnError:$true # 3.0.16 x32
                    Execute-MSI -Action Uninstall -Path '{1BB20266-7C52-4909-B075-22156F75D22C}' -ContinueOnError:$true # 3.0.16 x64
                    Execute-MSI -Action Uninstall -Path '{52165355-165A-4EED-8058-B0945F00ABDE}' -ContinueOnError:$true # 2.2.8 x32
                    Execute-MSI -Action Uninstall -Path '{34A66242-34A2-4049-9808-1A693370FACE}' -ContinueOnError:$true # 3.0.8 x64

                # den - remove old exe
                    if (test-path "C:\Program Files\VideoLAN\VLC") 
                        {Execute-Process -Path "$envProgramFiles\VideoLAN\VLC\uninstall.exe" -Parameters '/S' -WindowStyle 'Hidden' -ContinueOnError:$true}
                    if (test-path "C:\Program Files (x86)\VideoLAN\VLC") 
                        {Execute-Process -Path "$envProgramFilesX86\VideoLAN\VLC\uninstall.exe" -Parameters '/S' -WindowStyle 'Hidden' -ContinueOnError:$true}


                # den - remove catalog leftovers
                    if (test-path "C:\Program Files\VideoLAN") {Remove-Folder -Path "C:\Program Files\VideoLAN"}
                    if (test-path "C:\Program Files (x86)\VideoLAN") {Remove-Folder -Path "C:\Program Files (x86)\VideoLAN"}

                # den - user profile folder cleanups
                    if (test-path "C:\Users\Default\AppData\Roaming\vlc") {Remove-Folder -Path "C:\Users\Default\AppData\Roaming\vlc"}

                # den - remove folder in user profiles
                    $UserDir = "C:\Users"
                        Write-Host "$UserDir den-track" -ForegroundColor Cyan -BackgroundColor DarkGray
                    $Folders = Get-ChildItem -Path $UserDir
                        Write-Host "$Folders den-track" -ForegroundColor Yellow -BackgroundColor DarkGray
                        ForEach ($row in $Folders) 
                        {
                            if (Test-Path "$Userdir\$row\AppData\Roaming\vlc") {Remove-Folder -Path "$Userdir\$row\AppData\Roaming\vlc"}
                        }

I do it like this…

        If (Get-LoggedOnUser) {
            Show-InstallationWelcome -CloseApps "vlc" -PersistPrompt ##-BlockExecution
		}

        ## Remove MSI applications
        Write-Log -Message "Remove application." -Source $installPhase
        [psobject]$FoundSoftware = Get-InstalledApplication -Name "VLC media player"
        If ($FoundSoftware) {
            Remove-MSIApplications -Name "VLC media player*" -WildCard -ContinueOnError $true
            Start-Sleep -Seconds 5
        }

        ## Remove EXE applications
        [psobject]$FoundSoftware = Get-InstalledApplication -Name "VLC media player"
        If ($FoundSoftware) {
            Foreach ($UninstallPath in $FoundSoftware.UninstallString) {
                If ($UninstallPath.Contains('"')) {
                    $UninstallPath = [regex]::Match($UninstallPath,'"(.*?)"').Groups[1].Value
                }
                If (Test-Path -Path $UninstallPath -PathType Leaf) {
                    Execute-Process -Path $UninstallPath -Parameters "/S" -WindowStyle Hidden -ContinueOnError $true
                    Start-Sleep -Seconds 5
                } Else {
                     Write-Log -Message "Remove executable not found. [$UninstallPath]" -Severity 2 -Source $installPhase  
                }
            }
        }

            [string[]]$ProfilePaths = Get-UserProfiles | Select-Object -ExpandProperty "ProfilePath" ##-ExcludeDefaultUser $true
            ForEach($UserProfilePath in $ProfilePaths) {
                Write-Log -Message "Edit userprofile: [$UserProfilePath]" -Source $installPhase
                Remove-Folder -Path "$UserProfilePath\$AppDataRoaming\vlc"
            }
        }

There are no remaing folders…

1 Like