Basically I am trying to put together an IE11 uninstall script. I have found this guide from Microsoft: IE11 Uninstall guide But I want to do it with Powershell and DISM instead, since pkgmgr is depricated.
I have put together the below script:
# Get list of IE11 related components to remove
$filenames = Get-ChildItem -Path $env:windir\servicing\Packages | Where-Object { $_.Name -clike "Microsoft-Windows-InternetExplorer-*11.*.mum" }
# Use DISM to remove all the components found above
foreach ($filename in $filenames)
{
Dism.exe /Online /Remove-Package /Packagepath:($filename.FullName) /quiet /norestart
}
My problem is that the DISM command will fail because the /Packagepath: parameter fails to read the path. The above code will resolve the path to: ..../Packagepath: C:\Windows.... giving me a space between the ":" and the path.
Is there any way I can avoid that space, or alternatively remove that space?
Thanks.