forked from achawla5/PSScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimezoneRedirection.ps1
35 lines (28 loc) · 1.14 KB
/
TimezoneRedirection.ps1
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
<#Author : Akash Chawla
# Usage : Timezone redirection
#>
#######################################
# Timezone redirection #
#######################################
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
Write-Host "*** AVD AIB CUSTOMIZER PHASE: Timezone redirection ***"
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services"
$registryKey = "fEnableTimeZoneRedirection"
$registryValue = "1"
IF(!(Test-Path $registryPath)) {
New-Item -Path $registryPath -Force | Out-Null
}
try {
New-ItemProperty -Path $registryPath -Name $registryKey -Value $registryValue -PropertyType DWORD -Force | Out-Null
}
catch {
Write-Host "*** AVD AIB CUSTOMIZER PHASE *** Timezone redirection - Cannot add the registry key *** : [$($_.Exception.Message)]"
Write-Host "Message: [$($_.Exception.Message)"]
}
$stopwatch.Stop()
$elapsedTime = $stopwatch.Elapsed
Write-Host "*** AVD AIB CUSTOMIZER PHASE: Timezone redirection - Exit Code: $LASTEXITCODE ***"
Write-Host "*** AVD AIB CUSTOMIZER PHASE: Timezone redirection - Time taken: $elapsedTime ***"
#############
# END #
#############