2

We use the Powershell Application Deployment Toolkit for deploying applications in SCCM. I'm currently working on uninstalling Sophos VPN from machines in a certain collection in our environment.

Here is the uninstall part of the script. The problem is that clients will uninstall Sophos but won't remove the Sophos folder. The detection method is set to that folder, which leads to clients returning 'Removal Failed' errors, even though the program itself uninstalled.

Yes, I googled. There were batch files or small scripts that I really don't want to Frankenstein into the process.

Another part about this is that the way is installed requires you to login and it downloads a user specific (cert configured) .exe file.

Things I've tried

  1. Adding Remove-Folder later in the deployment script. (This didn't really have any impact. )

  2. Changing the Detection Method to the uninstall.exe (the uninstall.exe disappears when it's uninstalled). However, this method for whatever reason led to all the clients I put in the collection to succeed within SCCM without actually uninstalling the program.

  3. Changing the Detection Method to use the registry. This had the same result as the second effort.


Any suggestions or advice?

.

  • You need administrative access, when deleting folders from Program Files directory, do you run powershell as administrator? – Smeerpijp Mar 30 '16 at 12:52
  • This is correct, SCCM runs the script as administrator so that it can handle uninstalls and installs. @doenoe – Frightlin Mar 30 '16 at 14:46
  • Is Remove-Folder a valid Powershell cmdlet? When I run Get-command 'Remove-folder' I get errors that the cmd-let is not found. Try using Remove-item. Take a look here for information and parameters for Remove-Item. – Smeerpijp Mar 30 '16 at 15:04
  • @doenoe The Remove-Folder function is included with the Powershell Application Deployment Toolkit linked above -- the basis for their question here. – jscott Apr 1 '16 at 4:12
  • Have you tried manually running this outside of an SCCM deployment (so just running the script directly via PowerShell)? If so, are the results the same where the application removes but the folder still exists? Out of curiosity, after the uninstallation, what is left within the folder? Hopefully running this manually within ISE should show any errors the PowerShell script has (i.e. access denied). – Joe S Apr 4 '16 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.