Mundy

IT Knowledge Base

User Tools

Site Tools


set_password_never_expires_using_powershell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

set_password_never_expires_using_powershell [2018/04/09 09:56] (current)
Line 1: Line 1:
 +Today I wanted to set the "​Password Never Expires"​ setting but didn't have access to a GUI. I was using Hyper-V Server, ie Server Core. I could have used the admin tools from a Windows 7 computer, but in this case I was logging in remotely and didn't want to set up a VPN. So I found the following PowerShell commands to do the trick.
 +
 +Run PowerShell as Administrator and type in the following commands, replacing "​username"​ for your, um, username.
 +
 +<source lang=powershell>​
 +$user = [adsi]"​WinNT://​./​username"​
 +$user.UserFlags.value = $user.UserFlags.value -bor 0x10000
 +$user.CommitChanges()
 +</​source>​
  
set_password_never_expires_using_powershell.txt · Last modified: 2018/04/09 09:56 (external edit)