Created
August 2, 2018 21:42
-
-
Save gislig/985fff968096f3c655b1aba9e7e61660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Function that contains some default values and some $null values. | |
function CreateUser($SamAccountName, [string]$UPN = "domain.local", [bool]$Enabled = $True, $FirstName, $LastName){ | |
New-ADUser -SamAccountName $SamAccountName -UserPrinciplalName "$SamAccountName@$UPN" -Enabled $Enabled -FirstName $FirstName -SurName $LastName | |
} | |
#Creating a user with out the dfeaults | |
CreateUser -SamAccountName "Bob" -UPN "bob.com" -Enabled $False -FirstName "Bob" -LastName "Builder" | |
#Creating a user with the defaults | |
CreateUser -SamAccountName "Hugi" -FirstName "Hugi" -LastName "Freyr" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment