weixin_39925813
weixin_39925813
2020-12-09 09:46

vagrant user password expiry on Win2016 server std edition

Hello,

It has happened a few times now, that I use a box that is older than a month or so. At first boot, the system asks me to change the password for the "vagrant" user, and the WinRM config fails.


==> win2016: Waiting for machine to boot. This may take a few minutes...
    win2016: WinRM address: 127.0.0.1:55985
    win2016: WinRM username: vagrant
    win2016: WinRM execution_time_limit: PT2H
    win2016: WinRM transport: negotiate
    win2016: Warning: Authentication failure. Retrying...
    win2016: Warning: Authentication failure. Retrying...
    win2016: Warning: Authentication failure. Retrying...
    win2016: Warning: Authentication failure. Retrying...
    win2016: Warning: Authentication failure. Retrying...
    win2016: Warning: Authentication failure. Retrying...

Suggestion:

  • set "password never expires" on the vagrant user

该提问来源于开源项目:ruzickap/packer-templates

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

8条回答

  • weixin_39925813 weixin_39925813 5月前

    Hi!

    Just checked, looks good!

    
    ==> win2016: Updating 'peru/windows-server-2016-standard-x64-eval' with provider 'virtualbox' from version
    ==> win2016: '20190701.01' to '20190724.01'...
    

    image

    点赞 评论 复制链接分享
  • weixin_39998903 weixin_39998903 5月前

    Great... I hope this "trick" will also work for other Windows versions.

    Thank you

    点赞 评论 复制链接分享
  • weixin_39925813 weixin_39925813 5月前

    Works for win2019 datacenter also.

    点赞 评论 复制链接分享
  • weixin_39998903 weixin_39998903 5月前

    Great... Thanks for feedback...

    点赞 评论 复制链接分享
  • weixin_39998903 weixin_39998903 5月前

    Yes ... I know about it. I was also mentioned in #18.

    Unfortunately I do not know how to set "password never expires" which survive sysprep.

    You can see it here: https://github.com/ruzickap/packer-templates/blob/master/http/windows-2016/Autounattend.xml#L174 -> After sysprep this password setting disappear.

    点赞 评论 复制链接分享
  • weixin_39925813 weixin_39925813 5月前

    This could eventually be a good hint:

    • https://social.technet.microsoft.com/Forums/windows/en-US/e9622a79-379f-42d6-a6b0-b6adf1ef9776/set-account-password-never-expires-in-sysprep?forum=w7itproinstall
    • https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc766314(v=ws.10)

    If you could eventually set the following in %WINDIR%\Setup\Scripts\SetupComplete.cmd, which is run before the loggon screen the first time the server boots up:

    
    wmic useraccount where "name='vagrant'" set passwordexpires=false
    
    点赞 评论 复制链接分享
  • weixin_39998903 weixin_39998903 5月前

    Thank you for your advice.

    I used the way you mentioned above and it's working for Win 2016 Server. I hope it will work also for other "windows".

    I'll rebuild the images and let you know -> then you can test it...

    点赞 评论 复制链接分享
  • weixin_39998903 weixin_39998903 5月前

    I rebuild the Win2016 Server images (latest version 20190724.01) where I disabled the password expiration using the method mentioned above.

    Can you check it please and let me know if it's working fine?

    点赞 评论 复制链接分享

相关推荐