From 180545791694d45b5d65a11c426bc1373ef480dc Mon Sep 17 00:00:00 2001 From: Jens Du Four Date: Thu, 28 Mar 2024 15:23:03 +0100 Subject: [PATCH] Change scripts --- Intune_Remediation_Timezone/detection.ps1 | 22 +++++++++++++++------ Intune_Remediation_Timezone/remediation.ps1 | 5 +++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Intune_Remediation_Timezone/detection.ps1 b/Intune_Remediation_Timezone/detection.ps1 index fbf701b..d8a347d 100644 --- a/Intune_Remediation_Timezone/detection.ps1 +++ b/Intune_Remediation_Timezone/detection.ps1 @@ -1,7 +1,17 @@ -# Reg2CI (c) 2022 by Roger Zander try { - if(-NOT (Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location")){ exti 1 }; - if((Get-ItemPropertyValue -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location' -Name 'Value' -ea SilentlyContinue) -eq 'Allow') { } else { exit 1 }; -} -catch { exit 1 } -exit 0 \ No newline at end of file + if (-not (Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location")) { + return $false + exit 1 + } + if ((Get-ItemPropertyValue -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location' -Name 'Value' -ea SilentlyContinue) -eq 'Allow') { + return $true + exit 0 + } else { + return $false + exit 1 + } +} +catch { + return $false + exit 1 +} \ No newline at end of file diff --git a/Intune_Remediation_Timezone/remediation.ps1 b/Intune_Remediation_Timezone/remediation.ps1 index cc9c3dd..415c405 100644 --- a/Intune_Remediation_Timezone/remediation.ps1 +++ b/Intune_Remediation_Timezone/remediation.ps1 @@ -1,3 +1,4 @@ -# Reg2CI (c) 2022 by Roger Zander if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location") -ne $true) { New-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -force -ea SilentlyContinue }; -New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location' -Name 'Value' -Value 'Allow' -PropertyType String -Force -ea SilentlyContinue; \ No newline at end of file +New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location' -Name 'Value' -Value 'Allow' -PropertyType String -Force -ea SilentlyContinue; +if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate") -ne $true) { New-Item "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate" -force -ea SilentlyContinue }; +New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate' -Name 'Start' -Value 3 -PropertyType DWord -Force -ea SilentlyContinue; \ No newline at end of file