Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

user credential prompt

$
0
0

Hi ,

 

I have this script to change user password . One user has multiple admin account . So try to change password from powershell script. Here my question is is there any everytime script prompt for credentials because only respective account can change for respective admin user account.

 

 

 

 

 

 

 

 

 

 

# set new default password

$password

 

 

 

=ConvertTo-SecureString-AsPlainText"P@ssw0rd_123"-Force

 

# get list of account names (1 per line)

$list

 

 

 

=Get-Content-Path

D:\password\users.txt.txt

 

# loop through the list

ForEach

 

 

 

($uin$list

) {

 

 

 

 

if ( -not (Get-ADUser-LDAPFilter"(sAMAccountName=$u)"

)) {

 

 

 

Write-Host"Can't find $u

"

}

 

 

 

else

{

 

 

 

$user=Get-ADUser-Identity

$u

 

 

 

$user|Set-ADAccountPassword-NewPassword$password-Reset

 

 

 

 

 

 

Write-Host"changed password for $u

"

}

}

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles