使用DSC资源配置HKEY_CURRENT_USER实际上会更新HKEY_USERS \ .DEFAULT [英] Configuring HKEY_CURRENT_USER with DSC Resource actually updates HKEY_USERS\.DEFAULT

查看:301
本文介绍了使用DSC资源配置HKEY_CURRENT_USER实际上会更新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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆