-
Notifications
You must be signed in to change notification settings - Fork 97
/
onedrive.yml
74 lines (65 loc) · 2.19 KB
/
onedrive.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- hosts: computers
gather_facts: no
tasks:
- name: Configuration
win_regedit:
path: '{{ item.path }}'
name: '{{ item.name }}'
data: '{{ item.data|default(None) }}'
type: '{{ item.type|default("string") }}'
state: '{{ item.state|default("present") }}'
with_items:
# Remove OneDrive from Run hook for new users
- path: HKU:\Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
name: OneDrive
state: absent
# Remove OneDrive from Run hook for current user
- path: HKLM:\Software\Microsoft\Windows\CurrentVersion\Run
name: OneDrive
state: absent
# Remove OneDrive from Explorer Name Space Tree (32bit)
- path: HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}
name: System.IsPinnedToNameSpaceTree
data: 0
type: dword
# Remove OneDrive from Explorer Name Space Tree (64bit)
- path: HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}
name: System.IsPinnedToNameSpaceTree
data: 0
type: dword
- path: HKLM:\Software\Policies\Microsoft\Windows\OneDrive
name: DisableFileSyncNGSC
data: 1
type: dword
- path: HKLM:\Software\Wow6432Node\Policies\Microsoft\Windows\OneDrive
name: DisableFileSyncNGSC
data: 1
type: dword
tags:
- onedrive
- name: Remove OneDrive (1)
win_shell: |
taskkill.exe /F /IM OneDrive.exe
register: taskkill
changed_when: taskkill.rc == 0 and 'The process "OneDrive.exe" not found.' not in taskkill.stderr
failed_when: taskkill.rc != 0 and 'The process "OneDrive.exe" not found.' not in taskkill.stderr
ignore_errors: yes
tags:
- onedrive
- name: Remove OneDrive (2)
win_shell: |
%SYSTEMROOT%\System32\OneDriveSetup.exe /uninstall
%SYSTEMROOT%\SysWOW64\OneDriveSetup.exe /uninstall
ignore_errors: yes
tags:
- onedrive
- name: Remove OneDrive leftovers
win_file:
path: '{{ item }}'
state: absent
with_items:
- '%LOCALAPPDATA%\Microsoft\OneDrive'
- '%PROGRAMDATA%\Microsoft OneDrive'
- '%USERPROFILE%\OneDrive'
- '%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk'
- C:\OneDriveTemp