Skip to content

Commit 42524ca

Browse files
committed
Changes as per PR comments
1 parent 2f11115 commit 42524ca

4 files changed

Lines changed: 25 additions & 18 deletions

File tree

Modules/ComputerManagementDsc/DSCResources/MSFT_TimeZone/MSFT_TimeZone.psm1

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ $LocalizedData = Get-LocalizedData `
1717

1818
<#
1919
.SYNOPSIS
20-
Returns the current time zone of the node.
20+
Returns the current time zone of the node.
2121
2222
.PARAMETER IsSingleInstance
23-
Specifies the resource is a single instance, the value must be 'Yes'.
23+
Specifies the resource is a single instance, the value must be 'Yes'.
2424
2525
.PARAMETER TimeZone
26-
Specifies the time zone.
26+
Specifies the time zone.
2727
#>
2828
function Get-TargetResource
2929
{
@@ -58,13 +58,13 @@ function Get-TargetResource
5858

5959
<#
6060
.SYNOPSIS
61-
Sets the current time zone of the node.
61+
Sets the current time zone of the node.
6262
6363
.PARAMETER IsSingleInstance
64-
Specifies the resource is a single instance, the value must be 'Yes'.
64+
Specifies the resource is a single instance, the value must be 'Yes'.
6565
6666
.PARAMETER TimeZone
67-
Specifies the time zone.
67+
Specifies the time zone.
6868
#>
6969
function Set-TargetResource
7070
{
@@ -91,20 +91,19 @@ function Set-TargetResource
9191
}
9292
else
9393
{
94-
Write-Verbose -Message ($LocalizedData.TimeZoneAlreadySetMessage `
95-
-f $TimeZone)
94+
Write-Verbose -Message ($LocalizedData.TimeZoneAlreadySetMessage -f $TimeZone)
9695
}
9796
}
9897

9998
<#
10099
.SYNOPSIS
101-
Tests the current time zone of the node.
100+
Tests the current time zone of the node.
102101
103102
.PARAMETER IsSingleInstance
104-
Specifies the resource is a single instance, the value must be 'Yes'.
103+
Specifies the resource is a single instance, the value must be 'Yes'.
105104
106105
.PARAMETER TimeZone
107-
Specifies the time zone.
106+
Specifies the time zone.
108107
#>
109108
function Test-TargetResource
110109
{

Modules/ComputerManagementDsc/DSCResources/MSFT_TimeZone/en-us/MSFT_TimeZone.strings.psd1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# culture="en-US"
22
ConvertFrom-StringData -StringData @'
33
GettingTimeZoneMessage = Getting the time zone.
4-
ReplaceSystemTimeZoneMessage = Replace the System time zone.
54
SettingTimeZoneMessage = Setting the time zone.
65
TimeZoneAlreadySetMessage = Time zone already set to {0}.
76
TestingTimeZoneMessage = Testing the time zone.

Modules/ComputerManagementDsc/Modules/ComputerManagementDsc.Common/SetTimeZone.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// This file enables setting of the machine time zone
2+
// using .NET framework classes.
3+
// It can be used to set the time zone when the
4+
// PowerShell time zone cmdlets are not available.
5+
//
6+
// It creates a namespace Microsoft.PowerShell.TimeZone
7+
// containing the classes and structures required to
8+
// set the time zone.
19
using System;
210
using System.Collections.Generic;
311
using System.Linq;
@@ -208,11 +216,13 @@ public class TimeZone
208216
public static void Set(string name)
209217
{
210218
var regTimeZones = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones");
211-
// Print out all the possible time-zones.
212-
//foreach(var subKey in regTimeZones.GetSubKeyNames())
213-
//{
214-
// Console.WriteLine(subKey);
215-
//}
219+
if (DEBUG) {
220+
// Print out all the possible time-zones.
221+
foreach(var subKey in regTimeZones.GetSubKeyNames())
222+
{
223+
Console.WriteLine(subKey);
224+
}
225+
}
216226
var subKey = regTimeZones.GetSubKeyNames().Where(s => s == name).First();
217227
string daylightName = (string)regTimeZones.OpenSubKey(subKey).GetValue("Dlt");
218228
string standardName = (string)regTimeZones.OpenSubKey(subKey).GetValue("Std");

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ The **ComputerManagementDsc** module contains the following resources:
1717
containing this resource may be compiled on Windows Server 2008 R2/Windows 7 but
1818
can not be applied._
1919
- **TimeZone**: this resource is used for setting the time zone on a machine.
20-
It replaces the older standalone `xTimeZone` resource.
2120
- **VirtualMemory**: allows configuration of properties of the paging file on
2221
the local computer.
2322

0 commit comments

Comments
 (0)