Solved

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

Posted on 2010-09-14
4
933 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:
sedgwick earned 500 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

Join & Write a Comment

Companies that have implemented Microsoft’s Active Directory need to ensure that the Active Directory is configured and operating properly. If there are issues found and not resolved, it eventually leads the components to fail or stop working and fi…
Installing a printer using group policy preferences is not that hard let’s take a look at it. First lets open up your group policy console and edit the policy you want to add it to. I recommend creating a new policy for each printer makes it a l…
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 tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now