Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-09-14
4
Medium Priority
?
992 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 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Suggested Courses

722 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