## p4add-userspec ## aaron bockelie <# .SYNOPSIS Creates a userspec to insert into p4, based on required variables. .DESCRIPTION Returns a properly formatted user spec to the console. .EXAMPLE Create a user spec: p4add-userspec -displayname Bockelie, Aaron -username aaron.bockelie -email aaron.bockelie@example.com All parameters are required. .PARAMETER displayname The display name of the user. Typically account attribute .displayname in Active Directory. .PARAMETER username The user name of the user. Typically account attribute .samaccountname in Active Directory. .PARAMETER email The email address of the user. Typically account attribute .email in Active Directory. .FUNCTIONALITY Call this function to help with creating a new perforce user spec. #> Function p4add-userspec {param([Parameter(Mandatory = $true)]$displayname,[Parameter(Mandatory = $true)]$username,[Parameter(Mandatory = $true)]$email,$reviews)#begin function p4add-userspec $datefield = (get-date).year.tostring() + "`/" + (get-date).month.tostring() + "`/" + (get-date).day.tostring() + " " + (get-date).hour.tostring() + ":" + (get-date).Minute.tostring() + ":" + (get-date).second.tostring() #format date string to exactly what perforce wants $spec = "`r`nUser:`t" + $username + "`r`n`r`nEmail:`t" + $email + "`r`n`r`nUpdate:`t" + $datefield + "`r`n`r`nAccess:`t" + $datefield + "`r`n`r`nFullName:`t" + $displayname + "`r`n`r`n" + $reviews + "`r`n`r`n" #make that form that perforce is expecting for user created return $spec }