ActiveDriectory编程中,我添加了一个用户,得到了IADsUser接口pUser,如何将其设置第一次登陆必须修改密码??
开发环境:winXP, VC6
环境:Windows2000 advance Server,装了Active Driectory我用了
           CComBSTR sbstrProp;
  CComVariant svar;
           sbstrProp = "pwdLastSet";
           svar = 0;
           hr = padsUser->Put(sbstrProp, svar);
会返回0x8000500f错误!!

解决方案 »

  1.   

    0x8000500FL E_ADS_SCHEMA_VIOLATION The attempted action violates the directory service schema rules
      

  2.   

    这我知道,这项属性在ADSI接口中是只读的,那么哪个属性可以调置第一次登陆必须修改密码呢
      

  3.   

    If this value is set to 0 and the User-Account-Control attribute does not contain the UF_DONT_EXPIRE_PASSWD flag, then the user must set the password at the next logon.
    我看MSDN上的示例也是这样的,是不是因为跟其他属性冲突的缘故。
      

  4.   

    http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_useraccount.asp
    http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting01132004.asp
    http://msdn.microsoft.com/msdnmag/issues/0500/wmiprov/
      

  5.   

    这个问题我解决了,是属性名不对,PwdLastSet这设置对WinNT是无效的,而是passwordexpried(写法有点像这样,具体记不清楚)就可以设了
      

  6.   

    Win32_UserAccountThe Win32_UserAccount WMI class contains information about a user account on a Windows operating system. Note  Because both the Name and Domain are key properties, enumerating Win32_UserAccount on a large network can affect performance negatively. Calling GetObject or querying for a specific instance has less impact.
    The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties.
    class Win32_UserAccount : Win32_Account
    {
      uint32 AccountType;
      string Caption;
      string Description;
      boolean Disabled;
      string Domain;
      string FullName;
      datetime InstallDate;
      boolean LocalAccount;
      boolean Lockout;
      string Name;
      boolean PasswordChangeable;
      boolean PasswordExpires;
      boolean PasswordRequired;
      string SID;
      uint8 SIDType;
      string Status;
    };
    Methods