Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $path = Split-Path -parent $MyInvocation.MyCommand.Definition
- $importPath = $path + "users.txt"
- # EDIT to match your net bios domain name.
- $netBiosDomain = "corp"
- # EDIT adjust to your schedule needs
- $schedule = "weekly at Sun 12:00"
- # EDIT you need to adjust the password to match the password in createusers.ps1.
- $initialPass = ConvertTo-SecureString -AsPlainText "Passw0rd!" -force
- Import-CSV $importPath | ForEach-Object {
- $sam = $_.Username.ToLower()
- $username = $netBiosDomain + $sam
- $cred = New-Object System.Management.Automation.PSCredential ($username, $initialPass)
- New-SPManagedAccount -Credential $cred
- Set-SPManagedAccount -Identity $cred.UserName -AutoGeneratePassword -Schedule $schedule -confirm:$false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement