Hi,
It seems that the registry DSC resource is having trouble when the registry key has the colon (“:”) and “{” “}” characters.
The error for the code below is:
PowerShell DSC resource MSFT_RegistryResource failed to execute Test-TargetResource functionality with error message: (ERROR) Invalid PSDrive
‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\FX’ specified in registry key
‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\FX:{4bbd4ebc-d808-4efc-b0a6-83c62e4ac931}’
Configuration secRMM-Removable-Media-Policy
{
Import-DscResource -ModuleName ‘PSDesiredStateConfiguration’;
Import-DscResource -Name Script;
Node “localhost”
{
$registryKey = ‘{0}:{1}’ -f ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\FX’,
‘{4bbd4ebc-d808-4efc-b0a6-83c62e4ac931}’;
Registry secRMMIsInstalledOnNode
{
Ensure = ‘Present’
Key = $registryKey
ValueName = ‘Description’
ValueData = ‘Security Removable Media Manager’
ValueType = ‘String’
}
Script secRMMScript
{
GetScript =
{
@{}
}
TestScript =
{
$false
}
SetScript =
{
Write-Verbose ‘Hello’
}
DependsOn = ‘[registry]secRMMIsInstalledOnNode’;
}
}
}