;<ScriptSettings xmlns="http://tempuri.org/ScriptSettings.xsd">
; <ScriptPackager>
; <process>kix32.exe</process>
; <arguments />
; <extractdir>%TEMP%</extractdir>
; <files />
; <usedefaulticon>true</usedefaulticon>
; <showinsystray>false</showinsystray>
; <altcreds>false</altcreds>
; <efs>true</efs>
; <ntfs>true</ntfs>
; <local>false</local>
; <abortonfail>true</abortonfail>
; <product />
; <version>1.0.0.1</version>
; <versionstring />
; <comments />
; <includeinterpreter>false</includeinterpreter>
; <forcecomregistration>false</forcecomregistration>
; <consolemode>false</consolemode>
; <EnableChangelog>false</EnableChangelog>
; <AutoBackup>false</AutoBackup>
; <snapinforce>false</snapinforce>
; <snapinshowprogress>false</snapinshowprogress>
; <snapinautoadd>0</snapinautoadd>
; <snapinpermanentpath />
; </ScriptPackager>
;</ScriptSettings>
;endregion
CreateAccount("123456","Lastname Test", "LDAP://OU=test,OU=ouinformation,OU=nextleaveOU, dc=Domain ,dc=ad")
Function CreateAccount($UserName, $FullName, $ADsPath)
$OU = GetObject($ADsPath)
$UserObj = $OU.Create("User","cn="+$FullName)
$UserObj.Put("sAMAccountName", $UserName)
$UserObj.Put("givenName", "John") ;First Name
$UserObj.Put("Initials", "Frank") ;Initials
$UserObj.Put("sn", "Smith") ;Last Name(Surname)
$UserObj.Put("displayName","Smith" + IIf("smith", ", ","") + "John" + IIf("Frank", " ", "") + "Frank") ;Display name
$UserObj.Put("description", "Head Man in charge") ;Description
$UserObj.Put("physicalDeliveryOfficeName","Wahington, DC") ;Office
$UserObj.Put("telephoneNumber","222-555-5555");Telephone
$UserObj.Put("mail","first_Last@company.com") ;E-mail
$UserObj.Put("wWWHomePage","www.kixtart.org") ;Web page
$UserObj.Put("userPrincipalName", "123456") ;userPrincipalName
$UserObj.Put("scriptPath", "common.bat") ;Logon Script
$UserObj.Put("Street", "1234 A Street, NW") ;Street
$UserObj.Put("Password", "gensler")
$UserObj.SetInfo
; Added Code
$userObj.SetPassword("password") ;Sets the password to "newpassword"
$userObj.Put("pwdLastSet", 0) ;User has to change the pw as soon as he/she logs in
$userObj.AccountDisabled = 0 ;Enables the account
$UserObj.SetInfo
; Objects cleanup
$UserObj = 0
$OU = 0
EndFunction