-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathConfigure_Office.ps1
210 lines (180 loc) · 11.2 KB
/
Configure_Office.ps1
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#region Features
# Do not send additional diagnostic and usage data to Microsoft
# New-ItemProperty -Path HKCU:\Software\Microsoft\Office\Common\ClientTelemetry -Name SendTelemetry -PropertyType DWord -Value 3 -Force
# Disable LinkedIn features in Office applications
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Common\LinkedIn))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Common\LinkedIn -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Common\LinkedIn -Name OfficeLinkedIn -PropertyType DWord -Value 0 -Force
# Turn on Touch/Mouse Mode
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Common -Name OverridePointerMode -PropertyType DWord -Value 2 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Common -Name OverrideTabletMode -PropertyType DWord -Value 1 -Force
# Enable dark gray theme
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Common -Name "UI Theme" -Value 3 -Type DWord -Force
# if $GUID exists, user logged in with an MS account
if (Test-Path -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\AutoProvisioning)
{
if (Get-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\AutoProvisioning -Name UserId -ErrorAction Ignore)
{
$GUID = Get-ItemPropertyValue -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\AutoProvisioning -Name UserId
# Where all them data is stored
if (-not (Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\$GUID\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges"))
{
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\$GUID\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges" -Force
}
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\$GUID\Settings\1186\{00000000-0000-0000-0000-000000000000}" -Name Data -Value ([byte[]](3, 0, 0, 0)) -Type Binary -Force
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\$GUID\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges" -Name Data -Value ([byte[]](3, 0, 0, 0)) -Type Binary -Force
}
else
{
# Where all them data is stored
if (-not (Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges"))
{
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges" -Force
}
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}" -Name Data -Value ([byte[]](3, 0, 0, 0)) -Type Binary -Force
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges" -Name Data -Value ([byte[]](3, 0, 0, 0)) -Type Binary -Force
}
}
else
{
# Where all them data is stored
if (-not (Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges"))
{
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges" -Force
}
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}" -Name Data -Value ([byte[]](3, 0, 0, 0)) -Type Binary -Force
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Roaming\Identities\Anonymous\Settings\1186\{00000000-0000-0000-0000-000000000000}\PendingChanges" -Name Data -Value ([byte[]](3, 0, 0, 0)) -Type Binary -Force
}
# Remove the "Rich Text Document" context menu item
Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\.rtf" -Recurse -Force -ErrorAction Ignore
#endregion Features
#region Word
# Do not show the Start screen when application starts
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name DisableBootToOfficeStart -PropertyType DWord -Value 1 -Force
# Do not open e-mail attachments and other uneditable files in reading view
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name AllowAutoReadingMode -PropertyType DWord -Value 0 -Force
# Disable Protected View for files originating from the Internet
if (-not (Test-Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView -Name DisableInternetFilesInPV -PropertyType DWord -Value 1 -Force
# Disable Protected View for files located in potentially unsafe locations
if (-not (Test-Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView -Name DisableUnsafeLocationsInPV -PropertyType DWord -Value 1 -Force
# Disable Protected View for Word attachments
if (-not (Test-Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Security\ProtectedView -Name DisableAttachmentsInPV -PropertyType DWord -Value 1 -Force
# Show the ruler
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name Ruler -PropertyType DWord -Value 1 -Force
# Save AutoRecover information every 3 minutes
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name AutosaveInterval -PropertyType DWord -Value 3 -Force
# Enable the "Draw" tab
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name DrawInkTab -PropertyType DWord -Value 1 -Force
# Enable the "Developer" tab
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name DeveloperTools -PropertyType DWord -Value 1 -Force
#endregion Word
#region Excel
# Do not show the Start screen when application starts
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Excel\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Excel\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Excel\Options -Name DisableBootToOfficeStart -PropertyType DWord -Value 1 -Force
# Save AutoRecover information every 3 minutes
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Excel\Options -Name AutoRecoverTime -PropertyType DWord -Value 3 -Force
# Enable the "Draw" tab
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Excel\Options -Name DrawInkTab -PropertyType DWord -Value 1 -Force
# Enable the "Developer" tab
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Excel\Options -Name DeveloperTools -PropertyType DWord -Value 1 -Force
# Maximaze the ribbon
if (-not (Test-Path -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Toolbars\Excel))
{
New-Item -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Toolbars\Excel -Force
}
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Toolbars\Excel -Name QuickAccessToolbarStyle -PropertyType DWord -Value 16 -Force
# Disable R1C1 reference style
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Excel\Options -Name Options -PropertyType DWord -Value 343 -Force
#endregion Excel
#region Word
# Enable the "Developer" tab
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name DeveloperTools -PropertyType DWord -Value 1 -Force
# Do not show the Start screen when application starts
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name DisableBootToOfficeStart -PropertyType DWord -Value 1 -Force
# Show the ruler
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name Ruler -PropertyType DWord -Value 1 -Force
# Save AutoRecover information every 3 minutes
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name AutosaveInterval -PropertyType DWord -Value 3 -Force
# Enable the "Draw" tab
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Word\Options -Name DrawInkTab -PropertyType DWord -Value 1 -Force
# Maximaze the ribbon
if (-not (Test-Path -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Toolbars\Excel))
{
New-Item -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Toolbars\Excel -Force
}
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Toolbars\Excel -Name QuickAccessToolbarStyle -PropertyType DWord -Value 16 -Force
#endregion Word
#region Outlook
# Do not show the Start screen when application starts
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Options -Name DisableBootToOfficeStart -PropertyType DWord -Value 1 -Force
# Enable the "Draw" tab
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Options))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Options -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Options -Name DrawInkTab -PropertyType DWord -Value 1 -Force
# Enable the classic ribbon
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Preferences))
{
New-Item -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Preferences -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Office\16.0\Outlook\Preferences -Name EnableSingleLineRibbon -PropertyType DWord -Value 0 -Force
#endregion Outlook