Solved

Howto delete AccountExpirationDate

Posted on 2009-07-12
2
654 Views
Last Modified: 2012-05-07
I know how to set the AccountExpirationDate, but I do not know how to delete it? (I tried to set the Date to nothing, but that does not work.)

Dim Fieldname As String = "AccountExpirationDate"
        Dim dt As Date = _getDate(fieldname)
        Dim type As Type = mCurUsr.NativeObject.GetType
        If value.Ticks = 0 Then
            If Not dt.Ticks = 0 Then
                _setModified()
                type.InvokeMember(Fieldname, BindingFlags.SetProperty, Nothing, mCurUsr.NativeObject, New Object() {value})
                mF &= ", " & Fieldname
            End If
        Else
            If Not dt.Ticks = 0 Then dt.AddDays(-1)
            If Not value.Date = dt.Date Then
                _setModified()
                type.InvokeMember(Fieldname, BindingFlags.SetProperty, Nothing, mCurUsr.NativeObject, New Object() {value})
                mF &= ", " & Fieldname
 
            End If
        End If

Open in new window

0
Comment
Question by:ofnet
[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 Comments
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 50 total points
ID: 24835623
To set the user to never expire, the AccountExpires attribute is set to 9223372036854775807 (January 1st, 1601)
0
 

Author Closing Comment

by:ofnet
ID: 31602602
The Date 1/1/1601 did not work, but 1/1/1970 did work. Greate. Thx.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

749 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