使用DSC资源配置HKEY_CURRENT_USER实际上会更新HKEY_USERS \ .DEFAULT [英] Configuring HKEY_CURRENT_USER with DSC Resource actually updates HKEY_USERS\.DEFAULT
问题描述
以下DSC声明而不是HKEY_CURRENT_USER \ Console写入注册表项HKEY_USERS.DEFAULT \ Console.为什么?
Registry ConsoleFaceName
{
Key = 'HKEY_CURRENT_USER\Console'
ValueName = "FaceName"
ValueData = "Lucida Console"
Ensure = "Present"
}
写入.DEFAULT
的行为是因为DSC本地配置管理器(LCM)正在作为本地系统运行,该系统没有当前的用户注册表配置单元
如果要更新特定用户,则需要使用 PsDscRunAsCredential
(链接的文档),其中$Credential
是您要更改其值的用户的凭据.
Registry ConsoleFaceName
{
Key = 'HKEY_CURRENT_USER\Console'
ValueName = "FaceName"
ValueData = "Lucida Console"
Ensure = "Present"
PsDscRunAsCredential = $Credential
}
在执行此操作之前,请阅读保护MOF文件. >
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.
这篇关于使用DSC资源配置HKEY_CURRENT_USER实际上会更新HKEY_USERS \ .DEFAULT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!