Make C# application Group Policy aware
I want to make my app GPO aware. I know that it's basically just reading from a specific registry path b开发者_如何转开发ut 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
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.
精彩评论