-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathauditWindowsUpdateSettings
106 lines (105 loc) · 5.83 KB
/
auditWindowsUpdateSettings
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
/*
--author: @jkopacko
+= Descriptive names: N/A
+= Variable type: N/A
+= Value: N/A
+= Version 1.0 - 03/10/23
+= Query type: Live Discover
+= OS Support: Windows
*/
WITH autoUpdate (autoReboot, rebootTime,autoCheck, autoCheckInterval, autoUpdate,autoUpdateOptions,autoMaintenance, scheduledInstallDay,scheduledInstallTime,scheduledInstallWeek,autoInstallMinorUpdates) AS (SELECT
CASE
WHEN data = 1 THEN 'Enabled'
ELSE 'Disabled'
END,
CAST((SELECT data || ' minutes after update complete'
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'AlwaysAutoRebootAtScheduledTimeMinutes') AS VARCHAR),
CAST((SELECT CASE
WHEN data = 1 THEN 'Enabled'
ELSE 'Disabled'
END
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'DetectionFrequencyEnabled') AS VARCHAR),
CAST((SELECT 'Every ' || data || ' hours'
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au'
AND name = 'DetectionFrequency') AS VARCHAR),
CAST((SELECT CASE
WHEN data = 0 THEN 'Enabled'
ELSE 'Disabled'
END
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'NoAutoUpdate') AS VARCHAR),
CAST((SELECT CASE
WHEN data = 1 THEN 'Keep up to date is disabled'
WHEN data = 2 THEN 'Notify of download and installation'
WHEN data = 3 THEN 'Automatically download and notify of installation'
WHEN data = 4 THEN 'Automatically download and perform scheduled installation'
ELSE NULL
END
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'AUOptions') AS VARCHAR),
CAST((SELECT CASE
WHEN data = 0 THEN 'Enabled'
ELSE 'Disabled'
END
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'AutomaticMaintenanceEnabled') AS VARCHAR),
CAST((SELECT CASE
WHEN data = 0 THEN 'Everyday'
WHEN data = 1 THEN 'Sunday'
WHEN data = 2 THEN 'Monday'
WHEN data = 3 THEN 'Tuesday'
WHEN data = 4 THEN 'Wednesday'
WHEN data = 5 THEN 'Thursday'
WHEN data = 6 THEN 'Friday'
WHEN data = 7 THEN 'Saturday'
ELSE NULL
END
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'ScheduledInstallDay') AS VARCHAR),
CAST((SELECT
CASE
WHEN data = 0 THEN (data = 12) || ' AM'
WHEN data = 1 THEN data || ' AM'
WHEN data = 2 THEN data || ' AM'
WHEN data = 3 THEN data || ' AM'
WHEN data = 4 THEN data || ' AM'
WHEN data = 5 THEN data || ' AM'
WHEN data = 6 THEN data || ' AM'
WHEN data = 7 THEN data || ' AM'
WHEN data = 8 THEN data || ' AM'
WHEN data = 9 THEN data || ' AM'
WHEN data = 10 THEN data || ' AM'
WHEN data = 11 THEN data || ' AM'
WHEN data = 12 THEN data || ' PM'
WHEN data = 13 THEN (data=1) || ' PM'
WHEN data = 14 THEN (data=2) || ' PM'
WHEN data = 15 THEN (data=3) || ' PM'
WHEN data = 16 THEN (data=4) || ' PM'
WHEN data = 17 THEN (data=5) || ' PM'
WHEN data = 18 THEN (data=6) || ' PM'
WHEN data = 19 THEN (data=7) || ' PM'
WHEN data = 20 THEN (data=8) || ' PM'
WHEN data = 21 THEN (data=9) || ' PM'
WHEN data = 22 THEN (data=10) || ' PM'
WHEN data = 23 THEN (data=11) || ' PM'
ELSE NULL
END
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'ScheduledInstallTime') AS VARCHAR),
(SELECT name
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au'
AND name LIKE 'ScheduledInstall%Week'),
CAST((SELECT CASE
WHEN data = 1 THEN 'Silently install minor updates'
ELSE 'Tread minor update like other updates'
END
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au' AND name = 'AutoInstallMinorUpdates') AS VARCHAR)
FROM registry
WHERE key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\Au'
AND name = 'AlwaysAutoRebootAtScheduledTime')
SELECT * FROM autoUpdate