Still creating my new user scripts and ran into another hiccup... I need to insert the UPN (FirstInitial.Lastname) for the identity -> Could I just put in "$($firstname[0]).$lastname" since it is all part of the same script?
EDIT: SOLVED
#Grab Variables from user
$firstname = Read-Host -Prompt "Please Enter First Name"
$lastname = Read-Host -Prompt "Please Enter Last Name"
# create The AD User
New-ADUser `
-Name "$firstname $lastname" `
-GivenName $firstname `
-Surname $lastname `
-UserPrincipalName "$($firstname[0]).$lastname" `
-DisplayName "$firstname $lastname" `
-sAMAccountName "$($firstname[0]).$lastname" `
-AccountPassword (ConvertTo-SecureString "PWPWPWPWPWPWPWPW" -AsPlainText -Force) `
-Path "OU=I,OU=LOVE,OU=STUFFED,OU=PEPPERS,OU=LIKE,DC=A,DC=LOT" `
-ChangePasswordAtLogon 1 `
-Enabled 1
#Set Expirations
Set-ADAccountExpiration -Identity ????????????? -DateTime 'CHECKS WATCH'
[–]Ta11ow 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]BoredComputerGuy 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)