-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from PowerShell/dev
Merging release pull request
- Loading branch information
Showing
12 changed files
with
1,631 additions
and
22 deletions.
There are no files selected for viewing
1,132 changes: 1,132 additions & 0 deletions
1,132
DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.psm1
Large diffs are not rendered by default.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.schema.mof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ClassVersion("1.0.0"), FriendlyName("xRegistry")] | ||
class MSFT_xRegistryResource : OMI_BaseResource | ||
{ | ||
[Key] string Key; | ||
[Key] string ValueName; | ||
[Write] string ValueData[]; | ||
[Write,ValueMap{"String", "Binary", "Dword", "Qword", "MultiString", "ExpandString"},Values{"String", "Binary", "Dword", "Qword", "MultiString", "ExpandString"}] string ValueType; | ||
[Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; | ||
[Write] boolean Hex; | ||
[Write] boolean Force; | ||
}; |
16 changes: 16 additions & 0 deletions
16
DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.schema.mfl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma namespace("\\\\.\\root\\default") | ||
instance of __namespace{ name="MS_409";}; | ||
#pragma namespace("\\\\.\\root\\default\\MS_409") | ||
|
||
[Description("This resource is used to perform Get, Set and Test operations on Windows Registry.") : Amended,AMENDMENT, LOCALE(0x0409)] | ||
class MSFT_xRegistryResource : OMI_BaseResource | ||
{ | ||
[Key,Description("Path of the registry key.\n") : Amended] string Key; | ||
[Key,Description("Name of the registry key value.\n") : Amended] string ValueName; | ||
[Description("Data of the registry key value.\n") : Amended] string ValueData[]; | ||
[Description("Type of the registry key data.\n") : Amended] string ValueType; | ||
[Description("Enumerated value describing if the environment variable should exist on target machine.\nPresent {default} \nAbsent \n") : Amended] string Ensure; | ||
[Description("Flag to identify Hex or Decimal values.\n") : Amended] boolean Hex; | ||
[Description("Flag to specify forced execution.\n") : Amended] boolean Force; | ||
}; | ||
|
28 changes: 28 additions & 0 deletions
28
DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.strings.psd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Localized 10/30/2015 03:58 AM (GMT) 303:4.80.0411 MSFT_xRegistryResource.strings.psd1 | ||
# Localized resources for MSFT_xRegistryResource | ||
|
||
ConvertFrom-StringData @' | ||
###PSLOC | ||
ParameterValueInvalid=(ERROR) Parameter '{0}' has an invalid value '{1}' for type '{2}' | ||
InvalidPSDriveSpecified=(ERROR) Invalid PSDrive '{0}' specified in registry key '{1}' | ||
InvalidRegistryHiveSpecified=(ERROR) Invalid registry hive was specified in registry key '{0}' | ||
SetRegValueFailed=(ERROR) Failed to set registry key value '{0}' to value '{1}' of type '{2}' | ||
SetRegValueUnchanged=(UNCHANGED) No change to registry key value '{0}' containing '{1}' | ||
SetRegKeyUnchanged=(UNCHANGED) No change to registry key '{0}' | ||
SetRegValueSucceeded=(SET) Set registry key value '{0}' to '{1}' of type '{2}' | ||
SetRegKeySucceeded=(SET) Create registry key '{0}' | ||
SetRegKeyFailed=(ERROR) Failed to created registry key '{0}' | ||
RemoveRegKeyTreeFailed=(ERROR) Registry Key '{0}' has subkeys, cannot remove without Force flag | ||
RemoveRegKeySucceeded=(REMOVAL) Registry key '{0}' removed | ||
RemoveRegKeyFailed=(ERROR) Failed to remove registry key '{0}' | ||
RemoveRegValueSucceeded=(REMOVAL) Registry key value '{0}' removed | ||
RemoveRegValueFailed=(ERROR) Failed to remove registry key value '{0}' | ||
RegKeyDoesNotExist=Registry key '{0}' does not exist | ||
RegKeyExists=Registry key '{0}' exists | ||
RegValueExists=Found registry key value '{0}' with type '{1}' and data '{2}' | ||
RegValueDoesNotExist=Registry key value '{0}' does not exist | ||
RegValueTypeMismatch=Registry key value '{0}' of type '{1}' does not exist | ||
RegValueDataMismatch=Registry key value '{0}' of type '{1}' does not contain data '{2}' | ||
DefaultValueDisplayName=(Default) | ||
###PSLOC | ||
'@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
$ErrorActionPreference = 'Stop' | ||
|
||
Get-Module MSFT_xRegistryResource | Remove-Module -Force | ||
Import-Module $PSScriptRoot\..\DSCResources\MSFT_xRegistryResource\MSFT_xRegistryResource.psm1 -Prefix UnitTest | ||
|
||
Describe 'MSFT_xRegistryResource' { | ||
BeforeAll { | ||
$rootPath = 'Software\__MSFT_xRegistryResource__' | ||
$rootPathWithDrive = "HKCU:\$rootPath" | ||
if (Test-Path -LiteralPath $rootPathWithDrive) | ||
{ | ||
Remove-Item -LiteralPath $rootPathWithDrive -Recurse -Force | ||
} | ||
|
||
New-Item -Path $rootPathWithDrive | ||
} | ||
|
||
AfterAll { | ||
if (Test-Path -LiteralPath $rootPathWithDrive) | ||
{ | ||
Remove-Item -LiteralPath $rootPathWithDrive -Recurse -Force | ||
} | ||
} | ||
|
||
It 'Supports keys containing forward slashes' { | ||
$keyName = 'Test/Key' | ||
$valueName = 'Testing' | ||
$valueData = 'TestValue' | ||
|
||
$scriptBlock = { | ||
Set-UnitTestTargetResource -Key $rootPathWithDrive\$keyName ` | ||
-ValueName $valueName ` | ||
-ValueData $valueData ` | ||
-ValueType String ` | ||
-Force $true ` | ||
-ErrorAction Stop | ||
} | ||
|
||
$scriptBlock | Should Not Throw | ||
|
||
$regKey = (Get-Item HKCU:\).OpenSubKey("$rootPath\$keyName") | ||
|
||
$regKey | Should Not Be Null | ||
$regKey.GetValue($valueName) | Should Be $valueData | ||
} | ||
} | ||
|
Oops, something went wrong.