|
| |||||||||
| Tags: expires, net, option, password |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| net user password never expires option
i am using net user batch file to create and add 142 user, i need to use the password never expires option, but i am running into an issue, here is what i have net user ons1 #!wdfons1 /add /expires:never /passwordchg:no the result of this is the line saying the comand completed successfully, however when i look at the user properties, i see that the user cannot change password selection is marked, but the password nerver expires box is not marked. i am running this on windows 2000 server what have i done wrong. any help would be greatly appreciated. |
|
#2
| |||
| |||
| Re: net user password never expires option
network admin in need of help wrote: > i am using net user batch file to create and add 142 user, i need to > use the password never expires option, but i am running into an > issue, here is what i have > > net user ons1 #!wdfons1 /add /expires:never /passwordchg:no > > the result of this is the line saying the comand completed > successfully, however when i look at the user properties, i see that > the user cannot change password selection is marked, but the password > nerver expires box is not marked. > > i am running this on windows 2000 server > > what have i done wrong. any help would be greatly appreciated. Per C:\>net user /help /expires:never would apply to the user account expiration, not the password. Try this Jerold Schulman solution... JSI Tip 9625. How can a batch set a user's UserAccountControl attribute for 'Password never expires' on or off? <http://www.jsifaq.com/SF/Tips/Tip.aspx?id=9625> -- Michael Harris Microsoft MVP Scripting |
|
#3
| |||
| |||
| Re: net user password never expires option "Michael Harris (MVP)" wrote: > network admin in need of help wrote: > > i am using net user batch file to create and add 142 user, i need to > > use the password never expires option, but i am running into an > > issue, here is what i have > > > > net user ons1 #!wdfons1 /add /expires:never /passwordchg:no > > > > the result of this is the line saying the comand completed > > successfully, however when i look at the user properties, i see that > > the user cannot change password selection is marked, but the password > > nerver expires box is not marked. > > > > i am running this on windows 2000 server > > > > what have i done wrong. any help would be greatly appreciated. > > > Per C:\>net user /help > > /expires:never would apply to the user account expiration, not the password. > > Try this Jerold Schulman solution... > > JSI Tip 9625. How can a batch set a user's UserAccountControl attribute for > 'Password never expires' on or off? > <http://www.jsifaq.com/SF/Tips/Tip.aspx?id=9625> > > -- > Michael Harris > Microsoft MVP Scripting > > > thank you for your assistance. this does not look like it is working for me. it may just be me, i am new to scripting, i have written 3 .vbs and about 5 .bat and i am still an infant at it, learning more and more each day. can you explain to me what i would need to do to set it to work for me, or is there a line or 2 out of it that i need to incorporate into the script that i have? thanks again brian metzger |
|
#4
| |||
| |||
| Re: Re: net user password never expires option
On Sat, 23 Sep 2006 06:07:01 -0700, brian metzger <brianmetzger@discussions.microsoft.com> wrote: > > >"Michael Harris (MVP)" wrote: > >> network admin in need of help wrote: >> > i am using net user batch file to create and add 142 user, i need to >> > use the password never expires option, but i am running into an >> > issue, here is what i have >> > >> > net user ons1 #!wdfons1 /add /expires:never /passwordchg:no >> > >> > the result of this is the line saying the comand completed >> > successfully, however when i look at the user properties, i see that >> > the user cannot change password selection is marked, but the password >> > nerver expires box is not marked. >> > >> > i am running this on windows 2000 server >> > >> > what have i done wrong. any help would be greatly appreciated. >> >> >> Per C:\>net user /help >> >> /expires:never would apply to the user account expiration, not the password. >> >> Try this Jerold Schulman solution... >> >> JSI Tip 9625. How can a batch set a user's UserAccountControl attribute for >> 'Password never expires' on or off? >> <http://www.jsifaq.com/SF/Tips/Tip.aspx?id=9625> >> >> -- >> Michael Harris >> Microsoft MVP Scripting >> >> >> thank you for your assistance. > >this does not look like it is working for me. it may just be me, i am new to >scripting, i have written 3 .vbs and about 5 .bat and i am still an infant at >it, learning more and more each day. can you explain to me what i would need >to do to set it to work for me, or is there a line or 2 out of it that i need >to incorporate into the script that i have? > >thanks again >brian metzger Where is it failing? Did you change the @echo off to @echo on, remove the >nul 2>&1 and log the output? Jerold Schulman Windows Server MVP JSI, Inc. http://www.jsiinc.com http://www.jsifaq.com |
|
#5
| |||
| |||
| Re: Re: net user password never expires option "Jerold Schulman" wrote: > On Sat, 23 Sep 2006 06:07:01 -0700, brian metzger <brianmetzger@discussions.microsoft.com> wrote: > > > > > > >"Michael Harris (MVP)" wrote: > > > >> network admin in need of help wrote: > >> > i am using net user batch file to create and add 142 user, i need to > >> > use the password never expires option, but i am running into an > >> > issue, here is what i have > >> > > >> > net user ons1 #!wdfons1 /add /expires:never /passwordchg:no > >> > > >> > the result of this is the line saying the comand completed > >> > successfully, however when i look at the user properties, i see that > >> > the user cannot change password selection is marked, but the password > >> > nerver expires box is not marked. > >> > > >> > i am running this on windows 2000 server > >> > > >> > what have i done wrong. any help would be greatly appreciated. > >> > >> > >> Per C:\>net user /help > >> > >> /expires:never would apply to the user account expiration, not the password. > >> > >> Try this Jerold Schulman solution... > >> > >> JSI Tip 9625. How can a batch set a user's UserAccountControl attribute for > >> 'Password never expires' on or off? > >> <http://www.jsifaq.com/SF/Tips/Tip.aspx?id=9625> > >> > >> -- > >> Michael Harris > >> Microsoft MVP Scripting > >> > >> > >> thank you for your assistance. > > > >this does not look like it is working for me. it may just be me, i am new to > >scripting, i have written 3 .vbs and about 5 .bat and i am still an infant at > >it, learning more and more each day. can you explain to me what i would need > >to do to set it to work for me, or is there a line or 2 out of it that i need > >to incorporate into the script that i have? > > > >thanks again > >brian metzger > > Where is it failing? > Did you change the @echo off to @echo on, remove the >nul 2>&1 > and log the output? > > > Jerold Schulman > Windows Server MVP > JSI, Inc. > http://www.jsiinc.com > http://www.jsifaq.com i did not, i have now, this is what i have @echo on setlocal if {%2}=={} goto err set ons1=%1 set YN=%2 set /a pnx=65536 set /a upnx=0 if /i "%YN%" EQU "Y" goto swok if /i "%YN%" NEQ "N" goto err :swok set /a userAccountControl=999999999 call :getusr if %userAccountControl% EQU 999999999 goto usrnf if /i "%YN%" EQU "N" goto setoff set /a upnx=%userAccountControl% ^& %pnx% if %upnx% EQU %pnx% goto finish set /a userAccountControl=%userAccountControl% ^| 65536 call :updusr> goto finish :setoff set /a upnx=%userAccountControl% ^& %pnx% if %upnx% NEQ %pnx% goto finish set /a userAccountControl=%userAccountControl% ^^ 65536 call :updusr :finish endlocal goto :EOF :err @echo Syntax: PwdNX ons1 Y^|N endlocal :usrnf @echo Syntax: PwdNX ons1 Y^|N - %ons1% NOT found. endlocal goto :EOF :getusr for /f "Tokens=2 Delims=: " %%a in ('adfind -b %ons1% -nodn -noctl userAccountControl^|find /i "userAccountControl"') do ( set /a userAccountControl=%%a ) goto :EOF :updusr admod -b %ons1% "userAccountControl::%userAccountControl%" this is what the results are: the user name i am testing is ons1 password never expires option is still not checked. and the cmd prompt shows the following i ran from cmd prompt c:\>pwdnvrx.bat (this is the result) c:\>setlocal c:\>if {} == {} goto err syntax PwdNX ons1 Y:N c:\>endlocal Syntax: PwdNX ons1 Y:N - NOT found. c:\>endlocal c:\>goto :EOF c:\> what have i messed up. thanks for your help brian metzger > |
|
#6
| |||
| |||
| Re: Re: Re: net user password never expires option
On Sat, 23 Sep 2006 07:17:02 -0700, brian metzger <brianmetzger@discussions.microsoft.com> wrote: > > >"Jerold Schulman" wrote: > >> On Sat, 23 Sep 2006 06:07:01 -0700, brian metzger <brianmetzger@discussions.microsoft.com> wrote: >> >> > >> > >> >"Michael Harris (MVP)" wrote: >> > >> >> network admin in need of help wrote: >> >> > i am using net user batch file to create and add 142 user, i need to >> >> > use the password never expires option, but i am running into an >> >> > issue, here is what i have >> >> > >> >> > net user ons1 #!wdfons1 /add /expires:never /passwordchg:no >> >> > >> >> > the result of this is the line saying the comand completed >> >> > successfully, however when i look at the user properties, i see that >> >> > the user cannot change password selection is marked, but the password >> >> > nerver expires box is not marked. >> >> > >> >> > i am running this on windows 2000 server >> >> > >> >> > what have i done wrong. any help would be greatly appreciated. >> >> >> >> >> >> Per C:\>net user /help >> >> >> >> /expires:never would apply to the user account expiration, not the password. >> >> >> >> Try this Jerold Schulman solution... >> >> >> >> JSI Tip 9625. How can a batch set a user's UserAccountControl attribute for >> >> 'Password never expires' on or off? >> >> <http://www.jsifaq.com/SF/Tips/Tip.aspx?id=9625> >> >> >> >> -- >> >> Michael Harris >> >> Microsoft MVP Scripting >> >> >> >> >> >> thank you for your assistance. >> > >> >this does not look like it is working for me. it may just be me, i am new to >> >scripting, i have written 3 .vbs and about 5 .bat and i am still an infant at >> >it, learning more and more each day. can you explain to me what i would need >> >to do to set it to work for me, or is there a line or 2 out of it that i need >> >to incorporate into the script that i have? >> > >> >thanks again >> >brian metzger >> >> Where is it failing? >> Did you change the @echo off to @echo on, remove the >nul 2>&1 >> and log the output? >> >> >> Jerold Schulman >> Windows Server MVP >> JSI, Inc. >> http://www.jsiinc.com >> http://www.jsifaq.com > >i did not, i have now, this is what i have > >@echo on >setlocal >if {%2}=={} goto err >set ons1=%1 >set YN=%2 >set /a pnx=65536 >set /a upnx=0 >if /i "%YN%" EQU "Y" goto swok >if /i "%YN%" NEQ "N" goto err >:swok >set /a userAccountControl=999999999 >call :getusr >if %userAccountControl% EQU 999999999 goto usrnf >if /i "%YN%" EQU "N" goto setoff >set /a upnx=%userAccountControl% ^& %pnx% >if %upnx% EQU %pnx% goto finish >set /a userAccountControl=%userAccountControl% ^| 65536 >call :updusr> >goto finish >:setoff >set /a upnx=%userAccountControl% ^& %pnx% >if %upnx% NEQ %pnx% goto finish >set /a userAccountControl=%userAccountControl% ^^ 65536 >call :updusr >:finish >endlocal >goto :EOF >:err >@echo Syntax: PwdNX ons1 Y^|N >endlocal >:usrnf >@echo Syntax: PwdNX ons1 Y^|N - %ons1% NOT found. >endlocal >goto :EOF >:getusr >for /f "Tokens=2 Delims=: " %%a in ('adfind -b %ons1% -nodn -noctl >userAccountControl^|find /i "userAccountControl"') do ( > set /a userAccountControl=%%a >) >goto :EOF >:updusr >admod -b %ons1% "userAccountControl::%userAccountControl%" > > > >this is what the results are: >the user name i am testing is ons1 > >password never expires option is still not checked. > >and the cmd prompt shows the following > >i ran from cmd prompt > >c:\>pwdnvrx.bat >(this is the result) >c:\>setlocal > >c:\>if {} == {} goto err >syntax PwdNX ons1 Y:N > >c:\>endlocal >Syntax: PwdNX ons1 Y:N - NOT found. > >c:\>endlocal > >c:\>goto :EOF > >c:\> > >what have i messed up. >thanks for your help >brian metzger > > > > >> Are you being funny or just dense? 1. DO NOT modify the batch file. Copy/Paste it just as it is. 2. At the CMD.EXE prompt, type: pwdnx UserDN Y where UserDN is the distinguished name of ons1. Jerold Schulman Windows Server MVP JSI, Inc. http://www.jsiinc.com http://www.jsifaq.com |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "net user password never expires option" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| List all users with 'Password Never Expires' | Tim Page | Active Directory | 5 | 28-07-2010 05:30 PM |
| Can't remove 'password never expires' from some users | £Jim | Active Directory | 3 | 12-02-2009 04:46 PM |
| Log On Password Expires in X days | bullroar | Vista Help | 3 | 30-01-2009 01:52 AM |
| Password Expires | Diane Walker | Active Directory | 7 | 09-07-2008 11:20 PM |
| Password never expires-can't force user to change password | =?Utf-8?B?TWFyc2hh?= | Active Directory | 5 | 10-01-2005 09:21 PM |