cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Irishian88J
Engaged Sweeper
Greetings,

I am very new in the IT field and new to Lansweeper.

My project that I have been given is to eliminate OneDrive from our systems (We do not use it and a third party vulnerability scan shows some vulnerabilities.)I would like to wipe them out across all profiles in one go per machine.

I have been able to run the following script with no issues when I am on a machine:
cd /d %userprofile%
cd ..
for /F "tokens=*" %a in ('dir /ad/b') do cmd /c del /s/q "%a\AppData\Local\Microsoft\OneDrive"

However when I create an Install Package with that command in Lansweeper it consistently fails. Here is the error message:
Result: Deployment ended: Incorrect function. Stop(Failure). Credential: (csb\csbappservice). ShareCredential: (CSBAppService).
Command: cd /d %userprofile% cd .. for /F "tokens=*" %a in ('dir /ad/b') do cmd /c del /s/q "%a\AppData\Local\Microsoft\OneDrive"

Any help would be greatly appreciated.
3 REPLIES 3
Jack9366
Engaged Sweeper

It may be limited by a project at work, you can try to use OpenAI Playground to solve this problem

CyberCitizen
Honored Sweeper
Have you disabled it via Group Policy or Registry first to disable it from launching / being installed.

https://www.minitool.com/backup-tips/how-to-disable-onedrive.html
CyberCitizen
Honored Sweeper
Are you attempting to run that as the user account vs SYSTEM or scanning account.

As OneDrive installs on the machine under the local user profile the command will need to be run under the user account.