joernmasch
asked on
How to set the flag "Password expires never" for a user from the command prompt
Hi,
has anyone an idea, how I can set the flag "Password expires never" for a user from the command prompt under Windows 2000?
has anyone an idea, how I can set the flag "Password expires never" for a user from the command prompt under Windows 2000?
Well, I looked at the "net user" command, but it doesn't appear to have this option available. The "net accounts" command does, /maxpwage:unlimited, but it applies the change to all users in a domain.
Try the following:
net user username password /expires | never
For more info on net user, try:
net help user | more
Cheers.
net user username password /expires | never
For more info on net user, try:
net help user | more
Cheers.
This doesn't deal with the password retention. I looked at this also. Apparently you can set up an account to be available for a limited time. This would allow an ISP to have the system disable you when your subscription period ends:
"Causes the user account to expire if date is set; does not ever set a time limit on the user account. Expiration dates can be in mm/dd/yy, dd/mm/yy, or mmm,dd,yy format, depending on the Country/Region code. Note that the account expires at the beginning of the date specified. Months can be a number, spelled out, or abbreviated with three letters. Years can be two or four numbers. Use commas or slashes to separate parts of the date (no spaces). If yy is omitted, the next occurrence of the date (according to your computer's date and time) is assumed. For example, the following date entries are equivalent if entered between Jan. 10, 1994, and Jan. 8, 1995: "
"Causes the user account to expire if date is set; does not ever set a time limit on the user account. Expiration dates can be in mm/dd/yy, dd/mm/yy, or mmm,dd,yy format, depending on the Country/Region code. Note that the account expires at the beginning of the date specified. Months can be a number, spelled out, or abbreviated with three letters. Years can be two or four numbers. Use commas or slashes to separate parts of the date (no spaces). If yy is omitted, the next occurrence of the date (according to your computer's date and time) is assumed. For example, the following date entries are equivalent if entered between Jan. 10, 1994, and Jan. 8, 1995: "
Hi
First you need VBScript Engine 5.x installed
http://msdn.microsoft.com
Install ADSI
You find it here or on microsoft's site.
http://cwashington.netreach.net/main_site/downloads/default.asp?topic=essentials
Put the following in a .vbs file
'--- script beginning ---
Set objArgs = WScript.Arguments
Set UserObj = GetObject("WinNT://Compute rName/" & objArgs(0))
UserObj.AccountExpirationD ate = "21/08/2001 23:59:59"
UserObj.SetInfo
'WScript.Echo UserObj.AccountExpirationD ate
Set UserObj = Nothing
'--- end of ecript ---
Create a batch file with options like
for %%a in (user1 user2) do cscript expdate.vbs %%a
You need to give the right date in expdate.vbs
And replace ComputerName by the server name.
PS : tested without a batch file, just the .vbs file.
Longbow
First you need VBScript Engine 5.x installed
http://msdn.microsoft.com
Install ADSI
You find it here or on microsoft's site.
http://cwashington.netreach.net/main_site/downloads/default.asp?topic=essentials
Put the following in a .vbs file
'--- script beginning ---
Set objArgs = WScript.Arguments
Set UserObj = GetObject("WinNT://Compute
UserObj.AccountExpirationD
UserObj.SetInfo
'WScript.Echo UserObj.AccountExpirationD
Set UserObj = Nothing
'--- end of ecript ---
Create a batch file with options like
for %%a in (user1 user2) do cscript expdate.vbs %%a
You need to give the right date in expdate.vbs
And replace ComputerName by the server name.
PS : tested without a batch file, just the .vbs file.
Longbow
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes ok. But is it true that this tool only works when you have a PDC? I always get the message "unable to find your Primary Domain Controller" when I try this tool
Hi,
You have accepted the answer to soon.
What about the method i suggest you ?
You don't need anymore tools than these scripts once VBS Engine and ADSI are installed. On a Windows 2000 OS they are originally provided.
Longbow
You have accepted the answer to soon.
What about the method i suggest you ?
You don't need anymore tools than these scripts once VBS Engine and ADSI are installed. On a Windows 2000 OS they are originally provided.
Longbow