Skip to content

Commit b4bdd98

Browse files
author
Horacio Fernandez
committed
Merge pull request #1 from leshkinski/master
Initial module code completed
2 parents d3ebe78 + ee16e55 commit b4bdd98

8 files changed

Lines changed: 192 additions & 2 deletions

File tree

3.59 KB
Binary file not shown.
490 Bytes
Binary file not shown.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
function Get-TargetResource
2+
{
3+
[CmdletBinding()]
4+
[OutputType([System.Collections.Hashtable])]
5+
param
6+
(
7+
[parameter(Mandatory = $true)]
8+
[System.String]
9+
$TimeZone
10+
)
11+
12+
[string]$CurrentTZ = Invoke-Command {tzutil /g}
13+
Write-Verbose "Current TZ Setting is $CurrentTZ"
14+
15+
$returnValue = @{
16+
TimeZone = $CurrentTZ
17+
}
18+
19+
$returnValue
20+
}
21+
22+
23+
function Set-TargetResource
24+
{
25+
[CmdletBinding()]
26+
param
27+
(
28+
[parameter(Mandatory = $true)]
29+
[System.String]
30+
$TimeZone
31+
)
32+
33+
try
34+
{
35+
[string]$CurrentTZ = Invoke-Command {tzutil /g}
36+
Write-Verbose "Setting TZ Setting to $TimeZone"
37+
Invoke-Command {tzutil /s $TimeZone}
38+
}
39+
catch
40+
{
41+
42+
}
43+
}
44+
45+
46+
function Test-TargetResource
47+
{
48+
[CmdletBinding()]
49+
[OutputType([System.Boolean])]
50+
param
51+
(
52+
[parameter(Mandatory = $true)]
53+
[System.String]
54+
$TimeZone
55+
)
56+
57+
try
58+
{
59+
[string]$CurrentTZ = Invoke-Command {tzutil /g}
60+
Write-Verbose "Current TZ Setting is $CurrentTZ"
61+
62+
if ($CurrentTZ -like $TimeZone)
63+
{
64+
Write-Verbose "TZ setting is consistent"
65+
$result = $true
66+
}
67+
else
68+
{
69+
Write-Verbose "TZ setting is inconsistent"
70+
$result = $false
71+
}
72+
73+
}
74+
catch
75+
{
76+
77+
}
78+
79+
$result
80+
}
81+
82+
Export-ModuleMember -Function *-TargetResource
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
[ClassVersion("1.0"), FriendlyName("rsTime")]
3+
class RS_rsTime : OMI_BaseResource
4+
{
5+
[Key, Description("Provide desired system TZ (execute tzutil /l to see full list of possible options)")] String TimeZone;
6+
};
7+
13.8 KB
Binary file not shown.
822 Bytes
Binary file not shown.

README.md

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,105 @@
1-
rsInternationalSettings
1+
rsInternationalSettings DSC Module
22
=======================
33

4-
DSC Resource to manage international system settings
4+
**rsInternationalSettings** is a PowerShell DSC resource module, which can be used to manage international system settings such as setting system locale, time zone user keyboard layout and culture (formatting) settings.
5+
6+
##Changelog
7+
8+
######v0.0.1
9+
Added support for setting time zone, culture, system local and all local (including default) user profile settings.
10+
11+
####To-do:
12+
Add support for provision of an optional time server parameter
13+
14+
##Syntax##
15+
16+
See usage examples below...
17+
18+
###Usage Examples
19+
20+
**Set Server to US locale and user input**
21+
22+
This will force all system and user settings to US codepage, including input setting:
23+
24+
rsSysLocale SysLoc
25+
{
26+
SysLocale = "en-US"
27+
}
28+
29+
rsTime time
30+
{
31+
TimeZone = "Central Standard Time"
32+
}
33+
34+
rsUserLocale UserLocale
35+
{
36+
Name = "UserLocale"
37+
Culture = "en-US"
38+
LocationID = "244"
39+
LCIDHex = "0409"
40+
InputLocaleID = "00000409"
41+
}
42+
43+
44+
**Set Server to UK locale and user input**
45+
46+
This will force all system and user settings to UK codepage, including input setting:
47+
48+
rsSysLocale SysLoc
49+
{
50+
SysLocale = "en-GB"
51+
}
52+
53+
rsTime time
54+
{
55+
TimeZone = "GMT Standard Time"
56+
}
57+
58+
rsUserLocale UserLocale
59+
{
60+
Name = "UserLocale"
61+
Culture = "en-GB"
62+
LocationID = "242"
63+
LCIDHex = "0809"
64+
InputLocaleID = "00000809"
65+
}
66+
67+
68+
69+
###Acceptable parameter values
70+
71+
#####$Culture
72+
Default system codepage for non-Unicode applications.
73+
Use the following PowerShell command to list all available options:
74+
75+
[cultureinfo]::GetCultures([System.Globalization.CultureTypes]::AllCultures)
76+
77+
#####$TimeZone
78+
System time zone name description. Ex "GMT Standard Time"
79+
Use the `tzutil /l` command to list all possible options.
80+
81+
#####$LocationID
82+
Geographical System location ID (GEOID). Refer to [Table of Geographical Locations](http://msdn.microsoft.com/en-us/library/windows/desktop/dd374073(v=vs.85).aspx) for full list of possible options.
83+
84+
#####$LCIDHex
85+
Keyboard Language ID as defined by Microsoft. Used in combination with InputLocaleID, see [Keyboard Language & Locale IDs Assigned by Microsoft](http://msdn.microsoft.com/en-gb/goglobal/bb895996.aspx)
86+
87+
#####$InputLocaleID
88+
Locale ID as defined by Microsoft. Used in combination with LCIDHex, see [Keyboard Language & Locale IDs Assigned by Microsoft](http://msdn.microsoft.com/en-gb/goglobal/bb895996.aspx)
89+
90+
###Keyboard options tip:
91+
To easily identify correct settings for user keyboard options (*LCIDHex* & *InputLocaleID*), set the desired keyboard settings on a Windows 8/2012, or later, machine and run the following PS command `Get-WinUserLanguageList`. Property named "InputMethodTips" will provide the correct Language Code ID as `{<LCIDHex>:<InputLocaleID>}`.
92+
93+
#####Example:
94+
95+
PS C:\Users\Administrator> Get-WinUserLanguageList
96+
97+
LanguageTag : en-US
98+
Autonym : English (United States)
99+
EnglishName : English
100+
LocalizedName : English (United States)
101+
ScriptName : Latin script
102+
InputMethodTips : {0409:00000409}
103+
Spellchecking : True
104+
Handwriting : False
105+

rsInternationalSettings.psd1

1.67 KB
Binary file not shown.

0 commit comments

Comments
 (0)