We've the following script we want to use in Adaxes to create as part of user creation, to ask if the user will need a AWS workspace, then asks employeetype for different WS directory, and then computetype to create workspace.
How can I include this as a form based checkmarks or drop-down menus selectable by our helpdesk, the script works when I test it on the Adaxes host-
param(
[Parameter(Mandatory=$true)]
[string]$userName,
[Parameter(Mandatory=$true)]
[ValidateSet('Contractor','Salary')]
[string]$employeeType,
[Parameter(Mandatory=$true)]
[ValidateSet('Power','PowerPro')]
[string]$computeType
)
$Creds = (Use-STSRole -RoleArn "arn:aws:iam::*******424:role/ws_adaxes" -RoleSessionName adaxes).Credentials
if ( $employeeType -like 'Employee' )
{
$directoryId = 'd-*******07a'
} elseif ($employeeType -like 'Contractor')
{
$directoryId = 'd-******d2'
}
if ( $computeType -like 'Power' )
{
$bundleId = 'wsb-drh4m5c2r'
} elseif ($computeType -like 'PowerPro')
{
$bundleId = 'wsb-f5g1109b5'
}
$newWorkspaceOut = New-WKSWorkspace -Workspace @{"BundleID" = "$bundleId"; "DirectoryId" = "$directoryId"; "UserName" = "$userName"; "RootVolumeEncryptionEnabled" = $TRUE; "UserVolumeEncryptionEnabled" = $TRUE; "VolumeEncryptionKey"= "alias/aws/workspaces"; "WorkspaceProperties"=@{"RunningMode"="AUTO_STOP"}} -Credential $creds
if($newWorkspaceOut.FailedRequests)
{
$Context.LogMessage("Failed to create workspace.", "Error")
$Context.LogMessage($newWorkspaceOut.FailedRequests.errorMessage, "Error")
exit(-1)
}
else
{
$Context.LogMessage("Created workspace", "Information")
}