{"id":8746,"date":"2025-04-09T07:01:39","date_gmt":"2025-04-09T07:01:39","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=8746"},"modified":"2025-04-09T07:01:41","modified_gmt":"2025-04-09T07:01:41","slug":"get-all-intune-windows-updates-settings-in-powershell","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/get-all-intune-windows-updates-settings-in-powershell","title":{"rendered":"Get All Intune Windows Updates Settings in Powershell"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"\"># PowerShell Script to Display Intune Windows Update Settings\n# This script retrieves and displays Windows Update settings managed by Intune\n\n# Define the registry paths for Intune Windows Update settings\n$registryPaths = @(\n    \"HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\Update\",\n    \"HKLM:\\SOFTWARE\\Microsoft\\PolicyManager\\default\\Update\"\n)\n\n# Function to get registry values\nfunction Get-IntuneUpdateSettings {\n    param (\n        [Parameter(Mandatory = $true)]\n        [string]$Path\n    )\n\n    try {\n        if (Test-Path -Path $Path) {\n            $values = Get-ItemProperty -Path $Path -ErrorAction SilentlyContinue\n            if ($values) {\n                $values.PSObject.Properties | Where-Object { \n                    $_.Name -notlike \"PS*\" -and \n                    $_.Name -notlike \"*WinningProvider*\" -and\n                    $_.Name -notlike \"*ProviderSet*\"\n                } | ForEach-Object {\n                    [PSCustomObject]@{\n                        Path  = $Path\n                        Name  = $_.Name\n                        Value = $_.Value\n                        Type  = if ($null -eq $_.Value) { \"Null\" } else { $_.Value.GetType().Name }\n                    }\n                }\n            }\n        }\n    }\n    catch {\n        Write-Warning \"Error accessing $Path : $_\"\n    }\n}\n\n# Function to get setting description\nfunction Get-SettingDescription {\n    param (\n        [string]$SettingName,\n        [object]$Value\n    )\n\n    switch -Regex ($SettingName) {\n        \"BranchReadinessLevel\" {\n            switch ($Value) {\n                0 { return \"Windows Insider - Fast\" }\n                8 { return \"Windows Insider - Slow\" }\n                16 { return \"Semi-Annual Channel (Targeted)\" }\n                32 { return \"Semi-Annual Channel\" }\n                default { return \"Unknown Branch Level\" }\n            }\n        }\n        \"DeferQualityUpdatesPeriodInDays\" {\n            return \"Number of days to defer quality updates\"\n        }\n        \"DeferFeatureUpdatesPeriodInDays\" {\n            return \"Number of days to defer feature updates\"\n        }\n        \"ConfigureFeatureUpdateUninstallPeriod\" {\n            return \"Number of days before a feature update can be uninstalled\"\n        }\n        \"ActiveHoursStart\" {\n            return \"Start of active hours (in 24-hour format)\"\n        }\n        \"ActiveHoursEnd\" {\n            return \"End of active hours (in 24-hour format)\"\n        }\n        \"ScheduleRestartWarning\" {\n            return \"Hours before restart when warning is shown\"\n        }\n        \"ScheduleImminentRestartWarning\" {\n            return \"Minutes before restart when imminent warning is shown\"\n        }\n        \"ConfigureDeadlineForFeatureUpdates\" {\n            return \"Days before forced restart after feature update\"\n        }\n        \"AutoRestartRequiredNotificationDismissal\" {\n            switch ($Value) {\n                1 { return \"Allow user to dismiss restart notification\" }\n                2 { return \"Force restart after specified time\" }\n                default { return \"Unknown notification dismissal setting\" }\n            }\n        }\n        \"AllowAutoUpdate\" {\n            switch ($Value) {\n                0 { return \"Auto Update Disabled\" }\n                1 { return \"Auto Update Enabled\" }\n                default { return \"Unknown auto update setting\" }\n            }\n        }\n        \"PauseQualityUpdates\" {\n            switch ($Value) {\n                0 { return \"Quality Updates Not Paused\" }\n                1 { return \"Quality Updates Paused\" }\n                default { return \"Unknown pause setting\" }\n            }\n        }\n        \"PauseFeatureUpdates\" {\n            switch ($Value) {\n                0 { return \"Feature Updates Not Paused\" }\n                1 { return \"Feature Updates Paused\" }\n                default { return \"Unknown pause setting\" }\n            }\n        }\n        \"SetDisableUXWUAccess\" {\n            switch ($Value) {\n                0 { return \"Windows Update UI Access Enabled\" }\n                1 { return \"Windows Update UI Access Disabled\" }\n                default { return \"Unknown UI access setting\" }\n            }\n        }\n        \"ManagePreviewBuilds\" {\n            switch ($Value) {\n                0 { return \"Preview Builds Disabled\" }\n                1 { return \"Preview Builds Enabled\" }\n                default { return \"Unknown preview builds setting\" }\n            }\n        }\n        default {\n            return \"No description available\"\n        }\n    }\n}\n\n# Clear the screen\nClear-Host\n\n# Set console colors\n$host.UI.RawUI.ForegroundColor = \"White\"\n$host.UI.RawUI.BackgroundColor = \"Black\"\n\n# Collection for all results\n$allResults = @()\n\n# Get settings from registry paths\nWrite-Host \"Retrieving Intune Windows Update settings...\" -ForegroundColor Cyan\nforeach ($path in $registryPaths) {\n    if (Test-Path -Path $path) {\n        $results = Get-IntuneUpdateSettings -Path $path\n        $allResults += $results\n        $parentKey = $path -replace '^HKLM:\\\\', ''\n        Write-Host \"? Found $(($results | Measure-Object).Count) settings in $parentKey\" -ForegroundColor Green\n    }\n    else {\n        $parentKey = $path -replace '^HKLM:\\\\', ''\n        Write-Host \"? Path not found: $parentKey\" -ForegroundColor Red\n    }\n}\n\n# Display summary\n$totalSettings = ($allResults | Measure-Object).Count\nWrite-Host \"`nFound $totalSettings Windows Update settings`n\" -ForegroundColor Yellow\n\n# Group settings by category\n$updateSettings = $allResults | Where-Object { \n    $_.Name -match \"Defer|Pause|Update|Quality|Feature|Branch|Ring\"\n}\n\n$scheduleSettings = $allResults | Where-Object { \n    $_.Name -match \"Schedule|ActiveHours|Day|Time|Period|Start|End\"\n}\n\n$restartSettings = $allResults | Where-Object { \n    $_.Name -match \"Restart|Reboot|Deadline|Grace\"\n}\n\n# Function to display settings\nfunction Show-Settings {\n    param (\n        [string]$Title,\n        [array]$Settings\n    )\n    \n    Write-Host \"`n============== $Title ==============\" -ForegroundColor Yellow\n    \n    if ($Settings.Count -eq 0) {\n        Write-Host \"No settings found in this section.\" -ForegroundColor Gray\n    }\n    else {\n        foreach ($setting in $Settings) {\n            $relativePath = $setting.Path -replace '^HKEY_LOCAL_MACHINE\\\\|^HKLM:\\\\', ''\n            $keyPath = Split-Path -Path $relativePath -Leaf\n            \n            Write-Host \"$keyPath\\\" -NoNewline -ForegroundColor Cyan\n            Write-Host \"$($setting.Name): \" -NoNewline -ForegroundColor Green\n            \n            if ($setting.Type -eq 'Int32') {\n                Write-Host \"$($setting.Value) (Decimal)\" -NoNewline -ForegroundColor White\n                $description = Get-SettingDescription -SettingName $setting.Name -Value $setting.Value\n                Write-Host \" - $description\" -ForegroundColor Gray\n            }\n            elseif ($null -eq $setting.Value) {\n                Write-Host \"(null)\" -ForegroundColor Gray\n            }\n            else {\n                Write-Host \"$($setting.Value)\" -ForegroundColor White\n            }\n        }\n    }\n}\n\n# Display settings by category\nShow-Settings -Title \"UPDATE POLICY SETTINGS\" -Settings $updateSettings\nShow-Settings -Title \"SCHEDULE SETTINGS\" -Settings $scheduleSettings\nShow-Settings -Title \"RESTART SETTINGS\" -Settings $restartSettings\n\n# Display other important settings\n$otherSettings = $allResults | Where-Object { \n    $_.Name -match \"Allow|Set|Manage|Configure\" -and \n    -not ($updateSettings.Name -contains $_.Name) -and\n    -not ($scheduleSettings.Name -contains $_.Name) -and\n    -not ($restartSettings.Name -contains $_.Name)\n}\n\nShow-Settings -Title \"OTHER IMPORTANT SETTINGS\" -Settings $otherSettings\n\nWrite-Host \"`nScript completed successfully.\" -ForegroundColor Green <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8746","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=8746"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8746\/revisions"}],"predecessor-version":[{"id":8747,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8746\/revisions\/8747"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=8746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=8746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=8746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}