Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

c# Active Directory Tick "Password Never Expires" and more

Posted on 2010-09-14
4
Medium Priority
?
1,016 Views
Last Modified: 2012-05-10
Hey all im creating accounts in active directory but i need my script to also tick the "Password Never Expires" and untick "User Must Change Their Password on next logon" how do you do this?

Cheers,
0
Comment
Question by:KazooSoft
  • 2
4 Comments
 
LVL 4

Author Comment

by:KazooSoft
ID: 33670499
I have figured the password expiry


newUser.CommitChanges();
                newUser.Properties["userAccountControl"].Value = 0x10000;


But not the "User must change password at logon"
0
 

Expert Comment

by:shahbaz-ahmad
ID: 33670569
Try this. This is an example of VB script.


objUser.Put "pwdLastSet", 0
objUser.SetInfo

Open in new window

0
 

Expert Comment

by:shahbaz-ahmad
ID: 33670589
Cont from my previous post:

Default value of pwdLastSet is -1. By assigning value 0, you'll get your desire result.

Cheers,
0
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 total points
ID: 33670606
try the following:newUser.Properties["pwdLastSet"].Value = 0;newUser.CommitChanges();(http://geekswithblogs.net/mhamilton/archive/2005/10/20/57486.aspx)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question