guacamole-rest-api-documentation
guacamole-rest-api-documentation copied to clipboard
New-GuacUser in a foreach loop returning 500 (Internal Server Error)
The commands work independently...if I use the command "New-GuacUser -DataSource mysql -Parameters $GuacParameters" to create a single user, it works fine. I start getting the error when I put the command into a foreach loop and pull in names from a text file.
Other functions, like "Add-GuacUserConnection" in a foreach loop work just fine.
$password = "secretpassword" $userlist=(get-content userlist.txt) foreach ($user in $userlist) { $GuacParameters = @{ "username"= $user "password"= $password "attributes"= @{ "disabled"= "" "expired"= "" "access-window-start"= "" "access-window-end"= "" "valid-from"= "" "valid-until"= "" "timezone"= "" "guac-full-name"= "" "guac-organization"= "" "guac-organizational-role"= "" } } write-host ". . . . .Adding $user to Guacamole Server" New-GuacUser -DataSource mysql -Parameters $GuacParameters }