Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $online_migrate_users= @() #Create object for users that should be exported to CSV for Online migration
- $online_migrate_path= "\\fs01\IT\user-mgmt\new\online_export.csv"
- $online_license_users= @()
- #$online_migrate_mass= @()
- Function User-creation-cycle {
- switch ($OU)
- {
- {$_ -like '*KIEV*'} {echo "KIEV"} #{New-Aduser "$name $lastname" -GivenName $name -AccountPassword $pwd -DisplayName "$name $lastname" -Description "RN: $Description" -Enabled $true -OfficePhone "$extention" -PasswordNeverExpires $true -Path $OU -SamAccountName $sam -Server il-dc1.idi.local -Surname $lastname -UserPrincipalName "$sam@xforex.com" }
- {$_ -like '*Philippines*'} {echo "Phili"} #{New-Aduser "$name $lastname" -GivenName $name -AccountPassword $pwd -DisplayName "$name $lastname" -Description "RN: $Description" -Enabled $true -OfficePhone "$extention" -PasswordNeverExpires $true -Path $OU -SamAccountName $sam -Server il-dc1.idi.local -Surname $lastname -UserPrincipalName "$sam@xforex.com" }
- default {echo "Whohooo"} #{New-Aduser "$name $lastname" -GivenName $name -AccountPassword $pwd -DisplayName "$name $lastname" -Description "RN: $Description" -Enabled $true -OfficePhone "$extention" -Path $OU -SamAccountName $sam -Server il-dc1.idi.local -Surname $lastname -UserPrincipalName "$sam@xforex.com" }
- }
- Write-Host "User created at " -NoNewline; Write-Host "$OU" -ForegroundColor red -BackgroundColor white;
- <#echo " " >> \\fs01\IT\user-mgmt\new\log\$filename.log
- echo "----------------------------------------------" >> \\fs01\IT\user-mgmt\new\log\$filename.log
- echo "Display name: $name $lastname" >> \\fs01\IT\user-mgmt\new\log\$filename.log
- echo "Username: $sam" >> \\fs01\IT\user-mgmt\new\log\$filename.log
- echo "Password: $pwd_plain" >> \\fs01\IT\user-mgmt\new\log\$filename.log
- echo "Extention: $extention" #>
- Write-Host "SMTP address: " -NoNewline; Write-Host "$sam@xtrade.com" -ForegroundColor red -BackgroundColor white -NoNewline; Write-Host " not exists";
- Write-Host "Enabling mailbox with " -NoNewline; Write-Host "$sam@xtrade.com" -ForegroundColor red -BackgroundColor white -NoNewline; Write-Host " as main smtp address"
- Write-Host " "
- #[void](Enable-Mailbox -Identity "$sam@xforex.com" -Database DB1 -Alias $sam -DomainController il-dc1.idi.local -Force)
- #echo "Email: $sam@xtrade.com" >> \\fs01\IT\user-mgmt\new\log\$filename.log
- #echo "User created in $OU" >> \\fs01\IT\user-mgmt\new\log\$filename.log
- $migrate_smtp= "$sam@xforex.com"
- #Check if online migration needed
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement