让 C# 应用程序感知组策略
我想让我的应用程序 GPO 感知。我知道它基本上只是从特定的注册表路径读取,但我仍然有一些问题:
- 如何检测 GPO 刷新?这里有 RegisterGPNotification: http://msdn.microsoft.com /en-us/library/aa374404(VS.85).aspx 但是,那里或 Microsoft 是否有为 C# 准备好的东西?
- 什么是最佳实践:机器策略是否比用户策略更强,或者用户策略是否凌驾于机器策略之上?
- 有人想分享这方面的经验吗?
谢谢, 斯特凡
I want to make my app GPO aware. I know that it's basically just reading from a specific registry path but I still have some questions:
- How do I detect GPO refreshes? There's RegisterGPNotification here: http://msdn.microsoft.com/en-us/library/aa374404(VS.85).aspx but is there anything ready baked for C# out there or at Microsoft?
- What's considered best practice: is the machine policy stronger than the user policy or is the user policy overruling the machine policy?
- Anyone, who wants to share some experience in that area?
Thanks,
Stefan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通常使用 WM_SETTINGCHANGE 窗口消息来捕获后台 GP 刷新。该结构中的一个标志表明它是由政策还是其他原因引起的,因此您肯定要查找它。
至于是否使用每台计算机或每个用户,它实际上最终取决于您启用策略的应用程序类型。当 Microsoft 对每台计算机和每用户实施相同的策略时,通常每台计算机的设置会获胜,但并非普遍如此。
I typically use the WM_SETTINGCHANGE window message to trap for background GP refreshes. One of the flags in that stucture indicates whether it was caused by policy or something else so you definitely want to look for that.
In terms of whether to use per-computer or per-user, it really ends up being driven by the type of application you are policy-enabling. When Microsoft implements the same policy as both per-computer and per-user, generally the per-computer settings win, but not universally.