Link to home
Start Free TrialLog in
Avatar of credog
credog

asked on

Powershell Uninstall via uninstall string

I have the PS command below that I'm trying to use to uninstall onedrive on some systems.  The command "C:\Users\joe\AppData\Local\Microsoft\...." works fine from a standard Windows cmd.exe, but doesn't seem to work when in the PS command below.  I've tried various quoting and it doesn't seem to make a difference.
$output = Test-Path "C:\Users\joe\AppData\Local\Microsoft\OneDrive\20.143.0716.0003_1\OneDriveSetup.exe" ; if ($output -ne "True"){ $result='Removal path not found' } else { $result= 'Removing Onedrive';"C:\Users\joe\AppData\Local\Microsoft\OneDrive\20.143.0716.0003_1\OneDriveSetup.exe  /uninstall" }; $result

Open in new window

Also tried using the PS Uninstall-Package cmdlet instead of the C:\... command and that didn't seem to work at all.
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial