Script gets and loops through local users and disables password expiry. This should work for Windows 7 and up, it will likely not work with Microsoft linked accounts
# Get all local user accounts
$users = Get-LocalUser
# Loop through each user account and set password expiry to never
foreach ($user in $users) {
Set-LocalUser -Name $user.Name -PasswordNeverExpires $true
}