Team,
I am trying to develop a function for my account creation script that creates the username.
as of now this it what i have.
### Creating Username And Validation Test Function ###
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
$Firstname = [Microsoft.VisualBasic.Interaction]::InputBox("Enter Firstname of User")
$Lastname = [Microsoft.VisualBasic.Interaction]::InputBox("Enter Lastname of User")
$username= (($FirstName.Substring(0,1)) + ($LastName))
if ( $username.Length -gt 12) {
Write-Host "Charecter Longer than 12 charecters"
}
My dilemma is that i can not have a username longer than 12 characters for now. I am not sure how to approach this i already have to validate the username for availability in the domain and on a separate csv file for sap username.
I'm looking for a way that if the user name length is -gt 12 to be able to set it to 12 characters.