none
Change Lockout Duration with CMD RRS feed

  • Pergunta

  • Hi All,

    I know we can change the lockout duration to never from secpol/gpedit by setting it to 0

    But I want a simply way to do it with command prompt. Tried to run the following command but getting some error. 

    ##############################
    C:\>net accounts /lockoutduration:0
    System error 87 has occurred.

    The parameter is incorrect.
    ##############################

    Any idea how to make it work? I just want to change the lockout duration to forever with CMD.


    G





    • Editado Softholic sexta-feira, 3 de julho de 2020 07:31 typo
    quinta-feira, 2 de julho de 2020 05:17

Respostas

Todas as Respostas

  • Hello,

    Thank you for posting in our TechNet forum.

    I did the test in my lab, and below are the steps:

    1, Press the Windows + R keys to open the Run dialog, type Command Prompt –> Right Click Command Prompt –> Click "Run as administrator".

    2, Type "net accounts /lockoutduration:45" and the command completed successfully as shown below.



    We could have a recheck. For more information, we could refer to:
    https://www.windowspasswordsrecovery.com/articles/password-policy/set-account-lockout-duration-for-locked-out-user-account-in-windows-8-1-8-7.html

    For any question, please feel free to contact us.

    Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.

    Best regards,
    Hannah Xiong

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    sexta-feira, 3 de julho de 2020 02:56
  • Hi Hannah,
    Thanks for your reply. But I am looking to change the account lockout duration to NEVER (like below).

    How to do that with CMD or Powershell?
    As it will takes time for me if I need to do it from gpedit.msc, and change the value of Account Lockout Duration to 0.


    G

    sexta-feira, 3 de julho de 2020 07:30
  • Hi,

    You are welcome and thank you so much for your feedback.

    When I ran the command, I got the same result as shown below.



    According to our description, we would like to change the value of Account Lockout Duration to 0. If set to zero the system never automatically unlocks the account; an administrator must manually unlock it. This system will automatically unlock the account if this policy is set to between one and 99,999 minutes. This policy must be equal to or greater than Reset account lockout counter after.

    As mentioned, this policy must be equal to or greater than Reset account lockout counter after. If I set this policy less than Reset account lockout counter after, there is the same error as shown below. 



    To change the Reset account lockout counter after, we could use the below command:
    net accounts /lockoutwindow:Number

    Hope the information is helpful. For any question, please let us know.


    Best regards,
    Hannah Xiong

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    segunda-feira, 6 de julho de 2020 09:57
  • Hi Hannah,

    Yes I am aware about the condition where this policy must be equal to or greater than Reset account lockout counter after. But as you can see in my screenshot. Somehow I manage to make the Lockout duration to NEVER, where the Lockout observation window is 60.

    I manage to do this using gpedit.msc. So I was thinking to do the same with a script (cmd/vbs/powershell) to simplify and do it more faster. Is there a way to do that without the need to go to gpedit.msc?




    G

    segunda-feira, 6 de julho de 2020 14:56
  • Hi,

    Thank you so much for your feedback.

    Yes, we could manage to do this using gpedit.msc. But when doing this with the commands, there will be error as shown below. 



    When we changed the settings, if there is any conflict, the other items will be changed to the suggested values. 


    It seems that it could not do the same with the commands in the screenshot. As for the vbs or powershell script, we have the dedicated forums. We could turn to the forums for further assistance about this issue. Below are the forums links: 

    Powershellhttps://social.technet.microsoft.com/Forums/en-US/home?forum=winserverpowershell
    VBShttps://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral

    Thank you so much for your time and support.

    Best regards,
    Hannah Xiong

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Marcado como Resposta Softholic terça-feira, 7 de julho de 2020 08:30
    terça-feira, 7 de julho de 2020 06:10
  • Hi,

    Thanks Hannah. Will ask the same question in that forum.


    G

    terça-feira, 7 de julho de 2020 08:31
  • Hi,

    You are welcome. Thank you for sharing your experience here. It will be very beneficial for other community members who have similar questions. Your support is greatly appreciated.

    Thanks again and have a nice day.


    Best regards,
    Hannah Xiong

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    quarta-feira, 8 de julho de 2020 08:11