Jump to content

StephenTheTech

Members
  • Posts

    5
  • Joined

  • Last visited

Reputation Activity

  1. Like
    StephenTheTech reacted to Paul in Force local user account password change   
    Well $env:USERNAME relies on the current user and Pulseway runs in the context of the SYSTEM account. Try using this instead:
    $user= get-wmiobject -class win32_computersystem | select-object username wmic UserAccount where name=$user set Passwordexpires=true $username = $user.username if ($username -like '*\*') { $idx = $username.LastIndexOf('\') $username = $username.Substring($idx + 1) } net user $username /logonpasswordchg:yes It just removes the domain name or computer name from the username you get from WMI.
    -Paul
×
×
  • Create New...