"password never expires" 
Author Message
 "password never expires"

How do I turn of  "password never expires" through a WSH script.

DaveG



Fri, 23 Aug 2002 03:00:00 GMT  
 "password never expires"
This one took me alittle to find.  But, what you do is alter the users
"UserFlags" property and add the value 65536 to it or use the constant
"ADS_UF_DONT_EXPIRE_PASSWD".

So do something like this, I haven't tested this, so use at your own risk.

'***************************************************
dim adsUsr, lngFlag
Const ADS_UF_DONT_EXPIRE_PASSWD = 65536

set adsUsr=getObject(strUsrPath)
lngFlag = adsUsr.Get("UserFlags") + ADS_UF_DONT_EXPIRE_PASSWD
adsUsr.Put "UserFlags", lngFlag
adsUsr.SetInfo

'****************************************************

Quote:
> How do I turn of  "password never expires" through a WSH script.

> DaveG



Sat, 07 Sep 2002 03:00:00 GMT  
 "password never expires"
I found an example out on MSDN That shows it like this:
'***********************************************Set usr =
GetObject("WinNT://ArcadiaBay/JSmith")
flag = usr.Get("UserFlags")
newFlag = flag Or ADS_UF_DONT_EXPIRE_PASSWD
usr.Put "userFlags", newFlag
usr.SetInfo'***********************************************


Quote:
> How do I turn of  "password never expires" through a WSH script.

> DaveG



Sat, 07 Sep 2002 03:00:00 GMT  
 "password never expires"
Here is a sample demonstrating how to access user flags from
a script.

G. Born

'************************************************
' File:    ToggleUserFlag.vbs (WSH sample in VBScript)
' Author:  (c) Gnter Born
'
' Uses ADSI to set a userflag bit in a user account.
' Obtained from "Advanced Development with Microsoft
' Windows Scripting Host 2.0", Microsoft Press.
'************************************************
Option Explicit

Const UF_PASSWORD_CANT_CHANGE = &H40
Const UF_DONT_EXPIRE_PASSWD = &H10000

DIM oUser
DIM name, tmp
DIM domain

domain = "//Rom"
name = "Bill"

Set oUser = GetObject("WinNT:" & domain & "/" & name)

oUser.GetInfo                   'read the properties
' toggle "User cannot change password" and "Password never expires"
tmp = oUser.Get("UserFlags")    ' read flags
tmp = tmp XOR UF_PASSWORD_CANT_CHANGE
tmp = tmp XOR UF_DONT_EXPIRE_PASSWD

oUser.Put "UserFlags", tmp
oUser.SetInfo
WScript.Echo "Account " & name & " updated"

Set oUser = Nothing
WScript.Quit
' End

--
______________________________________________________
Check out the WSH Bazaar at www.borncity.de

DaveG schrieb in Nachricht ...

Quote:
>How do I turn of  "password never expires" through a WSH script.

>DaveG



Fri, 01 Nov 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Propertie "Password Never Expires..."

2. Remove "Password Never Expires" on everyone in my AD domain

3. Set "Password never expires" on NT/2K User account using only WSH/VBSCRIPT!

4. Response.Cookies("AnyCookieName").Expires

5. "Session variable expire by refreshing the page"?true:false

6. Disabling "BACK"/"FORWARD" buttons

7. CreateObject("Excel","//server"), MsgBox output

8. Problem With "window.showmodaldialog("")"

9. Disabling "BACK"/"FORWARD" buttons

10. How to Replace("String Irregular # of space", "?", "")

11. JavaScript "\"" and WShell Run

12. Password Expire - Help Needed

 

 
Powered by phpBB® Forum Software