Advertisement
Guest User

Untitled

a guest
Apr 6th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $online_migrate_users= @()                                              #Create object for users that should be exported to CSV for Online migration
  3. $online_migrate_path= "\\fs01\IT\user-mgmt\new\online_export.csv"
  4. $online_license_users= @()
  5. #$online_migrate_mass= @()
  6.  
  7. Function User-creation-cycle {
  8.     switch ($OU)
  9.         {
  10.             {$_ -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" }
  11.             {$_ -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" }
  12.             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" }
  13.         }
  14.     Write-Host "User created at " -NoNewline; Write-Host "$OU" -ForegroundColor red -BackgroundColor white;
  15.     <#echo " " >> \\fs01\IT\user-mgmt\new\log\$filename.log
  16.     echo "----------------------------------------------" >> \\fs01\IT\user-mgmt\new\log\$filename.log
  17.     echo "Display name: $name $lastname" >> \\fs01\IT\user-mgmt\new\log\$filename.log
  18.     echo "Username: $sam" >> \\fs01\IT\user-mgmt\new\log\$filename.log
  19.     echo "Password: $pwd_plain" >> \\fs01\IT\user-mgmt\new\log\$filename.log
  20.     echo "Extention: $extention" #>
  21.     Write-Host "SMTP address: " -NoNewline; Write-Host "$sam@xtrade.com" -ForegroundColor red -BackgroundColor white -NoNewline; Write-Host " not exists";
  22.     Write-Host "Enabling mailbox with " -NoNewline; Write-Host "$sam@xtrade.com" -ForegroundColor red -BackgroundColor white -NoNewline; Write-Host " as main smtp address"
  23.     Write-Host " "
  24.     #[void](Enable-Mailbox -Identity "$sam@xforex.com" -Database DB1 -Alias $sam -DomainController il-dc1.idi.local -Force)
  25.     #echo "Email: $sam@xtrade.com" >> \\fs01\IT\user-mgmt\new\log\$filename.log
  26.     #echo "User created in $OU" >> \\fs01\IT\user-mgmt\new\log\$filename.log
  27.     $migrate_smtp= "$sam@xforex.com"
  28.     #Check if online migration needed
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement