I have finally finished my employee turn over script and decided to keep on with the fun and start an on-boarding script. I have come to a block in trying to figure out how to go about this I will post below the two version i have of the script. What i want to achieve is creating a user, assigning them a license, adding the to certain distribution list. Where i'm stuck at is trying to figure out how to create a user and assign a license. Where i'm getting lost at is trying to figure out how i can both create a entire user with one variable and how to reference it later in the script by just the user name
$NewUser=Import-ModuleActiveDirectoryconnect-msolserviceNew-msoluser-LicenseAssignment-sku-UsageLocationUS-Displayname-Firstname-Lastname-userPrincipalNameImport-ModuleActiveDirectory$D=get-date$searchOU=...