categories/ExplorerStart.ps1
|
# Explorer/Start menu tweaks: show file extensions, disable Start menu "Recommended" section. # Both are per-user (HKCU) values, so this category does not require elevation. function Get-OctaExplorerStartCategory { [CmdletBinding()] param() return [pscustomobject]@{ Id = 'explorer-start' DisplayName = 'Explorer/Start' Description = 'Show file extensions, disable Start menu recommendations' RequiresElevation = $false ContainsIrreversibleActions = $false GetActionsFunction = 'Get-OctaExplorerStartActions' ApplyActionFunction = 'Set-OctaExplorerStartAction' } } function Get-OctaExplorerStartActions { [CmdletBinding()] param() $actions = @() $regPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' $current = (Get-ItemProperty -Path $regPath -Name 'HideFileExt' -ErrorAction SilentlyContinue).HideFileExt if ($null -eq $current -or $current -ne 0) { $displayCurrent = if ($null -eq $current) { '(not set)' } else { $current } $actions += New-OctaAction -TargetType Registry -TargetIdentifier "$regPath|HideFileExt" ` -CurrentValue $displayCurrent -PlannedValue 0 -Reversible $true } $recommended = (Get-ItemProperty -Path $regPath -Name 'Start_IrisRecommendations' -ErrorAction SilentlyContinue).Start_IrisRecommendations if ($null -eq $recommended -or $recommended -ne 0) { $displayCurrent = if ($null -eq $recommended) { '(not set)' } else { $recommended } $actions += New-OctaAction -TargetType Registry -TargetIdentifier "$regPath|Start_IrisRecommendations" ` -CurrentValue $displayCurrent -PlannedValue 0 -Reversible $true } return $actions } function Set-OctaExplorerStartAction { [CmdletBinding()] param([Parameter(Mandatory)]$Action) $keyPath, $valueName = $Action.TargetIdentifier -split '\|', 2 if (-not (Test-Path $keyPath)) { New-Item -Path $keyPath -Force | Out-Null } Set-ItemProperty -Path $keyPath -Name $valueName -Value $Action.PlannedValue -Type DWord } |