Page 1 of 1 1
Topic Options
#206993 - 2013-03-28 01:32 PM Set a AD password
GeorgeLittle Offline
Fresh Scripter

Registered: 2011-02-08
Posts: 47
Loc: UK
Hi,

Just wondering if its possible to modify a users AD password using KIX ?

Top
#207011 - 2013-03-30 12:33 AM Re: Set a AD password [Re: GeorgeLittle]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Yes, but I would not advise it.
Top
#207043 - 2013-04-03 02:21 PM Re: Set a AD password [Re: NTDOC]
GeorgeLittle Offline
Fresh Scripter

Registered: 2011-02-08
Posts: 47
Loc: UK
I wouldent advise it either but I have a very specific requriement NTDOC. Could you advise me how ?
Top
#207044 - 2013-04-03 02:34 PM Re: Set a AD password [Re: GeorgeLittle]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
It's not that hard, make SURE you change the OU and Username accordingly, and only run this script as a Domain Administrator:
 Code:
$=SetOption('Explicit','On')
Dim $objUser, $objRootDSE
Dim $strContainer, $strDNSDomain, $strUserName, $strPassword 

$objRootDSE = GetObject("LDAP://RootDSE") 
$strDNSDomain = $objRootDSE.Get("DefaultNamingContext") 

$strContainer = "OU=Accounts, "
$strUserName = "CN=Justin Case, "
$strPassword = "P@ssw0rd"
$strContainer = $strUser + $strContainer + $strDNSDomain

$objUser = GetObject("LDAP://" + $strContainer )
$objUser.SetPassword($strPassword)
$objUser.SetInfo

Top
#207045 - 2013-04-03 02:37 PM Re: Set a AD password [Re: GeorgeLittle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
You can try working with this:
 Code:
Function User_PWReset($_UserID)

  Dim $_objUser, $_Default

  $_objUser = getobject('WinNT://' + $_UserID  + ',user')

  If $_objUser
    $_Default = 'D3f@u!T'         ; default password
    $_objUser.PasswordExpired = 1
    $_objUser.setPassword($_Default)
    $_objUser.SetInfo
  EndIf

  $User_PWReset = Not @ERROR  
  Exit @ERROR

EndFunction
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.056 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org