Check for long usernames

This commit is contained in:
James Stringer 2021-12-12 19:36:17 +01:00
parent 6ded99d066
commit c222dfda65

View File

@ -32,8 +32,8 @@ if ($params.Username -eq $params.VMName ) {
if (!($params.Username -match "^[a-zA-Z0-9]+$")) {
$ExitReason += "Username cannot contain special characters."
}
if (!($params.VMName -match "^[a-zA-Z0-9]+$")) {
$ExitReason += "VMName cannot contain special characters."
if (($params.VMName -notmatch "^[a-zA-Z0-9]+$") -or ($params.VMName.Length -gt 15)) {
$ExitReason += "VMName cannot contain special characters, or be more than 15 characters long"
}
if (([Environment]::OSVersion.Version.Build -lt 22000) -and ($params.GPUName -ne "AUTO")) {
$ExitReason += "GPUName must be set to AUTO on Windows 10."