Password never expires - comman dline

  • 186 Views
  • Last Post 21 September 2017
adriaoramos posted this 31 August 2017

Hello,
I have a list of more than a hundred users to set password never expires. How can I do that from the command line?

Thank you

Order By: Standard | Newest | Votes
effepiz posted this 31 August 2017

Import-Module

activedirectory

get-content

C:\users.txt |

ForEach-Object {Get-ADUser

-Identity $_

| Set-ADUser

–PasswordNeverExpires $true}

 

 

show

Mahdi posted this 31 August 2017

‎Import-csv c:\users.csv | % { set-aduser $_ -passwordneverexpires:$true}








Something like that. Sorry I am on phone and can't recall :)










Sent from my BlackBerry 10 smartphone.















show







Hello,


I have a list of more than a hundred users to set password never expires. How can I do that from the command line?



Thank you

adriaoramos posted this 31 August 2017

Thank you
















Adriao

Ferreira Ramos



Equipe

de infraestrutura



Departamento

de Operações e Infraestrutura - CII



tel




+55 11 3388-8193







adriaoramos@xxxxxxxxxxxxxxxx



imprimir







sabesp

sp

face

twiter

youtube









De:      

 "Pizzitola Francesco

(Ext. - Value Transformation Services)" <FPIZZITOLA.external@xxxxxxxxxxxxxxxx>


Para:      

 "'ActiveDir@xxxxxxxxxxxxxxxx'"

<ActiveDir@xxxxxxxxxxxxxxxx>


Data:      

 08/31/2017 08:22 AM


Assunto:    

   RE: [ActiveDir]

Password never expires - comman dline


Enviado por:    

   ActiveDir-owner@xxxxxxxxxxxxxxxx








Import-Module

activedirectory


get-content

C:\users.txt

|

ForEach-Object

{Get-ADUser

-Identity

$_

|

Set-ADUser

–PasswordNeverExpires

$true}




 


 

show

stevelane85 posted this 04 September 2017

First locate active directory accounts with passwords set to Never Expire:
https://community.spiceworks.com/how_to/128015-how-to-locate-active-directory-accounts-with-passwords-set-to-never-expire

Then,

Import-Module ActiveDirectory

Get-ADUser -SearchScope onelevel -SearchBase "OU=someOU,DC=yourDomain,DC=com" -Filter * | Set-ADUser -CannotChangePassword:$true -PasswordNeverExpires:$true

Set password never expire on bulk via powershell:
http://powersloth.com/set-password-never-expires-ps1/

Powershell: Set AD Users Password Never Expires flag:
http://www.morgantechspace.com/2015/03/powershell-set-ad-users-password-never-expires-flag.html

Hope this helps!

jhondrake posted this 21 September 2017

You can try this PowerShell command:

 

import-csv c:\change.csv | ForEach-Object {Set-ADUser -Identity $_.SamAccountName -PasswordNeverExpires:$FALSE}

Close