Thanks. This is likely my best course of action. I'll ping back here if I need more assistance.
On Mon, Aug 30, 2021 at 11:37 PM Matthieu Courtois < [email protected]> wrote: > Hello, > > > > You can use my PowerShell module for this: > https://github.com/UpperM/guacamole-powershell > > > > *De :* James <[email protected]> > *Envoyé :* mardi 31 août 2021 01:48 > *À :* [email protected] > *Objet :* Re: API add connection > > > > Actually, just goto the ui, hit f12 then add the connection. You can see > the body and uri passed in network. Probably just a syntax error > > > > On Mon, Aug 30, 2021, 6:42 PM James <[email protected]> wrote: > > When I get to work tomorrow, I'll post the snippet you need. > > > > On Mon, Aug 30, 2021, 6:35 PM Justin Engwer <[email protected]> wrote: > > Hi, > > I'm admittedly pretty poor at JSON and Powershell. I'm hoping someone here > can give me a hand. I have a script for installing and configuring VNC on a > given domain PC. I'm currently attempting to write web requests to add a > new connection. I have authentication working, it's just the actual > creation of a new VNC connection that's broken. Keeps giving me error 500. > Any suggestions? > > > > ### Add connection to guacamole WIP > > $pc = $args[0] > > [Net.ServicePointManager]::SecurityProtocol = > [Net.SecurityProtocolType]::Tls12 > > > > # Obtain Token > > $postParams = "username=api&password=aaaaaaa" > > $t = Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens > -Method POST -Body $postParams|ConvertFrom-Json | select AuthToken > > $token = $t.Authtoken > > > > # test thing > > $param = @{ > > parentIdentifier = "ROOT"; > > name = "aaaaaaaaaaaaaaa"; > > protocol = "vnc"; > > parameters = { > > port = "5900"; > > password = "aaa"; > > hostname = "$pc" > > } > > } > > $diet = $param | convertto-json > > Invoke-WebRequest -Uri " > https://remoteaccess.domain.ca/api/session/data/mysql/connections?token=$token" > -ContentType "application/json" -Method POST -Body $diet > > > > # Deauthenticate token > > Invoke-WebRequest -Uri https://remoteaccess.domain.ca/api/tokens/$token > -Method DELETE -Body "token=$token" > > > > > > > > > -- > > > *Justin Engwer* > > -- *Justin Engwer* Mautobu Business Services 250-415-3709
