$user = 'abc\testadmin'
$pass = 'passtest'
$login = New-Object System.Management.Automation.PSCredential -ArgumentList @($user,(ConvertTo-SecureString -String $pass -AsPlainText -Force))
Import-Module ActiveDirectory
$list=IMPORT-CSV "C:\myLdap\ldapuserlist.csv"
echo "Setting pasword"
foreach($_ in $list)
{
$Uname="cn=" + $_.UserName + ",CN=Users,DC=tech-jockey,DC=com"
Set-ADAccountPassword –Identity $Uname -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "default-password" –Force) -Partition "DC=tech-jockey,DC=com" -Credential $login -server 192.168.1.100:78910
Enable-ADAccount -Identity $Uname -Credential $login -Partition "DC=tech-jockey,DC=com" -server 192.168.1.100:78910
}
echo "Completed"
$pass = 'passtest'
$login = New-Object System.Management.Automation.PSCredential -ArgumentList @($user,(ConvertTo-SecureString -String $pass -AsPlainText -Force))
Import-Module ActiveDirectory
$list=IMPORT-CSV "C:\myLdap\ldapuserlist.csv"
echo "Setting pasword"
foreach($_ in $list)
{
$Uname="cn=" + $_.UserName + ",CN=Users,DC=tech-jockey,DC=com"
Set-ADAccountPassword –Identity $Uname -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "default-password" –Force) -Partition "DC=tech-jockey,DC=com" -Credential $login -server 192.168.1.100:78910
Enable-ADAccount -Identity $Uname -Credential $login -Partition "DC=tech-jockey,DC=com" -server 192.168.1.100:78910
}
echo "Completed"
No comments:
Post a Comment
Thanks for showing interest in tech-jockey.