RSOP over WMI - Problem getting local policy data on Server 2008 R2


i have application programmatically display current password policy settings c# on server 2008 r2 machine. have working fine domain attached machines, more difficult find needed non-domain attached machines.

eventually got wmi query did wanted, tested , working on 64-bit windows 7 professional (which thought pretty close 2008 r2). unfortunately, same query returns 18 objects on development node (including 4 care about) returns 0 objects on server 2008 r2.

the application on 2008 r2 machine runs service under local system, however, repeated testing local administrator no change observed. narrowed issue down small test app:

using system;  using system.management;    // must add reference system.management build  using system.collections.generic;  using system.linq;  using system.text;    namespace consoleapplication1  {    class program    {      static void main(string[] args)      {        managementobjectsearcher searcher = new managementobjectsearcher("root\\rsop\\computer", "select * rsop_policysetting");        managementobjectcollection collect = searcher.get();        console.writeline("search returned {0} objects.\n", collect.count);        foreach (managementobject queryobj in searcher.get())        {          console.writeline("----{0}----", queryobj.path);          foreach (propertydata q in queryobj.properties)          {            console.writeline("{0} -> '{1}'", q.name, q.value);          }        }      }    }  }  

works on win7 workstation, returns 0 objects (and no errors or exceptions) on server 2008 r2. tested both domain attached , not domain attached (but trying information not domain atttached).

ultimately, whatever method, trying to read following 4 settings c# local, not domain, policy, when not attached domain:

-enforce password history (how many passwords remembered)
-minimum password age (how many days)
-minimum password length (in characters)
-password must meet complexity requirements (yes/no)

anybody got ideas? :) reading.

 



you try posting question in c# forum:

http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/threads


mcp windows server mcts .net



Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file