From c20d6847a4926fdc2f5674635462bfa698dd8f3f Mon Sep 17 00:00:00 2001 From: Jens Du Four Date: Thu, 28 Mar 2024 15:26:55 +0100 Subject: [PATCH] Update remediation script --- Intune_Remediation_Timezone/remediation.ps1 | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Intune_Remediation_Timezone/remediation.ps1 b/Intune_Remediation_Timezone/remediation.ps1 index 415c405..280d3d1 100644 --- a/Intune_Remediation_Timezone/remediation.ps1 +++ b/Intune_Remediation_Timezone/remediation.ps1 @@ -1,4 +1,19 @@ -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; -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 +$RegistryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" +$RegistryProperty = "Value" +$RegistryValue = "Allow" + +if (!(Test-Path -LiteralPath $RegistryPath)) { + New-Item -Path $RegistryPath -Force -ErrorAction SilentlyContinue +} + +New-ItemProperty -Path $RegistryPath -Name $RegistryProperty -Value $RegistryValue -PropertyType String -Force -ErrorAction SilentlyContinue + +$ServicePath = "HKLM:\SYSTEM\CurrentControlSet\Services\tzautoupdate" +$ServiceProperty = "Start" +$ServiceValue = 3 + +if (!(Test-Path -LiteralPath $ServicePath)) { + New-Item -Path $ServicePath -Force -ErrorAction SilentlyContinue +} + +New-ItemProperty -Path $ServicePath -Name $ServiceProperty -Value $ServiceValue -PropertyType DWord -Force -ErrorAction SilentlyContinue