The following DSC declaration writes to Registry key HKEY_USERS.DEFAULT\Console instead of HKEY_CURRENT_USER\Console. Why?
Registry ConsoleFaceName
{
Key = 'HKEY_CURRENT_USER\Console'
ValueName = "FaceName"
ValueData = "Lucida Console"
Ensure = "Present"
}
The behavior of writing to .DEFAULT
is because the DSC Local Configuration Manager (LCM) is running as local system, which does not have a current user registry hive.
If you want it to update a particular user you need to run using PsDscRunAsCredential
(docs linked), where $Credential
is the credentials from the user you want to change the value for.
Registry ConsoleFaceName
{
Key = 'HKEY_CURRENT_USER\Console'
ValueName = "FaceName"
ValueData = "Lucida Console"
Ensure = "Present"
PsDscRunAsCredential = $Credential
}
Before doing this please read Securing the MOF File.