 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the local user account settings using PowerShell?
To set the local user account settings related to the account or the password expiration, we can use the Set-LocalUser command.
The below command will change the local user Testuser account and password set to never expire.
Set-LocalUser -Name Testuser -AccountNeverExpires -PasswordNeverExpires $true -Verbose
The below command will set the account expiry,
Set-LocalUser -Name Testuser -AccountExpires 05/11/2022 -Verbose
To run the above commands on the remote computers, use the Invoke-Command.
Invoke-Command -ComputerName Computer1, computer2 -ScriptBlock{ Set-LocalUser -Name Testuser -AccountNeverExpires -PasswordNeverExpires $true -Verbose } Invoke-Command -ComputerName Computer1, computer2 -ScriptBlock{ Set-LocalUser -Name Testuser -AccountExpires 05/11/2022 -Verbose }Advertisements
 