pmcx9 Posted October 24, 2003 Posted October 24, 2003 I have a vbs script which I call from the main_batch.cmd to try to prevent the automatically created user (from cmdlines.txt) from having to change his password after a few weeks.The vbs is called usingECHO.ECHO turning password expiry off%SystemDrive%\install\cscript //B passexpoff.vbsECHO.and the script is called passexpoff.vbs'' Prevent password expiry on user %_USER% (environment variable)'' Run with:' cscript //B passexpoff.vbs'' Requires these environment variables:' COMPUTERNAME (the computer name according to the OS)' _USER (the user name to prevent password expiry on)'Option ExplicitDim oWshShell, oWshEnvironment, userName, compName, usr, flagSet oWshShell = CreateObject("WScript.Shell")Set oWshEnvironment = oWshShell.Environment("Process")userName = oWshEnvironment("_USER")compName = oWshEnvironment("COMPUTERNAME")Set usr = GetObject("WinNT://" & compName & "/" & userName)flag = usr.Get("UserFlags")if (flag AND &H10000 = 0) then usr.Put "UserFlags", flag XOR &H10000end ifusr.SetInfoboth are located in the %oem%\$1\install folder along with a copy of cscriptIt doesn't appear to be doing the trick though. Any help is appreciated By the way this is how I create a user that autologs in rather than the administrator on first boot. Perhaps there are switches for the "DefaultUserPassword" line that might disable password expires?install.cmdset _USER=Doodnet user %_USER% "" /add >nulnet localgroup administrators "%_USER%" /add>nul%SystemRoot%\system32\reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" /d "%_USER%" /f%SystemRoot%\system32\reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserPassword" /d "" /f%SystemRoot%\system32\reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /d "1" /f cmdlines.txt[COMMANDS]".\installs.cmd"
pmcx9 Posted October 24, 2003 Author Posted October 24, 2003 just changed it to this and it worksConst ADS_UF_DONT_EXPIRE_PASSWD = &h10000strDomainOrWorkgroup = "MSHOME"strComputer = "OEM999"strUser = "Dood"Set objUser = GetObject("WinNT://" & strDomainOrWorkgroup & "/" & _ strComputer & "/" & strUser & ",User")objUserFlags = objUser.Get("UserFlags")objPasswordExpirationFlag = objUserFlags OR ADS_UF_DONT_EXPIRE_PASSWDobjUser.Put "userFlags", objPasswordExpirationFlag objUser.SetInfo
GreenMachine Posted October 24, 2003 Posted October 24, 2003 Don't mean to burst your bubble, but I like this method:NET ACCOUNTS /MAXPWAGE:UNLIMITED
pmcx9 Posted October 24, 2003 Author Posted October 24, 2003 it doesnt put a tick in the box "password never expires" like my way doeshard for me to check as the password prompts dont begin for about 14 days
gareththegod Posted October 24, 2003 Posted October 24, 2003 why don't you just set your pc clock foward a few weeks
GreenMachine Posted October 24, 2003 Posted October 24, 2003 @pmcx9: That's an answer I can respect. I think the tick means that the password never expires for THIS USER, where as the command is a global setting.
bigred Posted November 20, 2003 Posted November 20, 2003 I'm wondering if someone could help me on this...When I call the vbs ECHO turning password expiry off%SystemDrive%\install\CScript //B passexpoff.vbsECHO.I get an error saying "'C:\Documents and Settings\Alison\passexpoff.vbs was not found"I'm not sure what "//B" is for....but I have cscript and passexpoff both in the install folder....Can anyone tell me what I'm doing wrong? Thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now