PowerShell is a cross-platform (Windows, Linux, and macOS) automation tool and configuration framework optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models. PowerShell includes a command-line shell, object-oriented scripting language, and a set of tools for executing scripts/cmdlets and managing modules.
Remove VLC silently
I'm quite new to Powershell, so I might have missed something obvious, but i'm trying to uninstall a specific VLC version (2.2.8) silently via PowerShell, it seems to run the script, but the VLC version still remains installed.
UninstallString: C:\Program Files\VideoLAN\VLC\uninstall.exe
The script works with MSI uninstall, but not from the uninstall string from the exe I've tried to remove some of the parameters like /quiet and /qn to see the CMD window but it just blinks and then closes in 1 second.
Any help will be appreciated!
$x64App = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' | Get-
ItemProperty |
Where-Object {$_.DisplayName -match "vlc" -and $_.DisplayVersion -match "2.2.8" } |
Select-Object -Property DisplayName, UninstallString, Displayversion
$x86App = Get-ChildItem 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' |
Get-ItemProperty |
Where-Object {$_.DisplayName -match "vlc" -and $_.DisplayVersion -match "2.2.8" } |
Select-Object -Property DisplayName, UninstallString, Displayversion
if ($x64App)
{
$UninstallPath = ($x86App |Get-ItemProperty UninstallString)
Start-Process cmd -ArgumentList "/c $UninstallPath /norestart" -wait
}
elseif($x86App)
{
$UninstallPath = ($x64App |Get-ItemProperty UninstallString)
Start-Process cmd -ArgumentList "/c $UninstallPath /norestart" -wait
}
$uninst is an empty variable? The first time it appears is on your argumentlist property
Try
$UninstallPath = ($x86App).UninstallString Start-Process cmd -ArgumentList "/c $UninstallPath /norestart" -wait
Do the same with the 64bit section.
There’s almost certainly a switch to enable logging to a known directory.
I found a solution:
$VLCver = Get-ChildItem -Path
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall,
HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Where-Object {$_.DisplayName -match "VLC" -and $_.DisplayVersion -match "2.2.8"} |
Select-Object -Property DisplayName, UninstallString, DisplayVersion
ForEach ($ver in $VLCver) {
If ($ver.UninstallString) {
$uninst = $ver.UninstallString
& cmd /c $uninst /norestart /S -wait
}
}
Please keep some version of VLC on work machines, will save you in the long run.
https://twitter.com/SwiftOnSecurity/status/729130597977718784?s=19