Solved

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

Posted on 2010-09-14
4
949 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
A hard and fast method for reducing Active Directory Administrators members.
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

752 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