Skip to content

Latest commit

 

History

History
279 lines (259 loc) · 7.48 KB

README.md

File metadata and controls

279 lines (259 loc) · 7.48 KB

PSGuacamole

alt text

GitHub release

This PowerShell module provides a series of cmdlets for interacting with the Apache Guacamole API, performed by wrapping Invoke-RestMethod for the API calls.

Table of Contents

Getting Started

Requirements

Requires PowerShell 3.0 or above as this is when Invoke-RestMethod was introduced.

Installation

Download the latest release and extract the folder to your module location ($env:PSModulePath).

Load the module

Import-Module -Name PSGuacamole

Once you've done this, all the cmdlets will be at your disposal.

Examples

Authentification

Get new token

New-GuacToken -Username "admin" -Password "MyPassword" -Server "http://srv-guacamole:8080/guacamole"

User Management

Create a new user

$Parameters = @{
    "username"= "test"
    "password"= "pass"
    "attributes"= @{
      "disabled"= ""
      "expired"= ""
      "access-window-start"= ""
      "access-window-end"= ""
      "valid-from"= ""
      "valid-until"= ""
      "timezone"= ""
      "guac-full-name"= ""
      "guac-organization"= ""
      "guac-organizational-role"= ""
    }
}

New-GuacUser -DataSource mysql -Parameters $Parameters

Retrieve user

Get-GuacUser -Username "john.doe" -DataSource "mysql"

Retrieve user connection history

Get-GuacUser -Username "john.doe" -DataSource "mysql" -Details history

Remove User

Remove-GuacUser -Username "john.doe" -DataSource "mysql"

Connections Management

Retrieving all connections

Get-GuacConnections -DataSource "mysql"

Retrieving a connection

Get-GuacConnection -DataSource mysql -ConnectionId 41 -Details $False -History $False

Create RDP connection

$RDPParameters = @{
        "parentIdentifier"= "ROOT"
        "name"= "New RDP Connection"
        "protocol"= "rdp"
        "parameters"= @{
          "port"= ""
          "read-only"= ""
          "swap-red-blue"= ""
          "cursor"= ""
          "color-depth"= ""
          "clipboard-encoding"= ""
          "disable-copy"= ""
          "disable-paste"= ""
          "dest-port"= ""
          "recording-exclude-output"= ""
          "recording-exclude-mouse"= ""
          "recording-include-keys"= ""
          "create-recording-path"= ""
          "enable-sftp"= ""
          "sftp-port"= ""
          "sftp-server-alive-interval"= ""
          "enable-audio"= ""
          "security"= ""
          "disable-auth"= ""
          "ignore-cert"= ""
          "gateway-port"= ""
          "server-layout"= ""
          "timezone"= ""
          "console"= ""
          "width"= ""
          "height"= ""
          "dpi"= ""
          "resize-method"= ""
          "console-audio"= ""
          "disable-audio"= ""
          "enable-audio-input"= ""
          "enable-printing"= ""
          "enable-drive"= ""
          "create-drive-path"= ""
          "enable-wallpaper"= ""
          "enable-theming"= ""
          "enable-font-smoothing"= ""
          "enable-full-window-drag"= ""
          "enable-desktop-composition"= ""
          "enable-menu-animations"= ""
          "disable-bitmap-caching"= ""
          "disable-offscreen-caching"= ""
          "disable-glyph-caching"= ""
          "preconnection-id"= ""
          "hostname"= ""
          "username"= ""
          "password"= ""
          "domain"= ""
          "gateway-hostname"= ""
          "gateway-username"= ""
          "gateway-password"= ""
          "gateway-domain"= ""
          "initial-program"= ""
          "client-name"= ""
          "printer-name"= ""
          "drive-name"= ""
          "drive-path"= ""
          "static-channels"= ""
          "remote-app"= ""
          "remote-app-dir"= ""
          "remote-app-args"= ""
          "preconnection-blob"= ""
          "load-balance-info"= ""
          "recording-path"= ""
          "recording-name"= ""
          "sftp-hostname"= ""
          "sftp-host-key"= ""
          "sftp-username"= ""
          "sftp-password"= ""
          "sftp-private-key"= ""
          "sftp-passphrase"= ""
          "sftp-root-directory"= ""
          "sftp-directory"= ""
        }
        "attributes"= @{
          "max-connections"= ""
          "max-connections-per-user"= ""
          "weight"= ""
          "failover-only"= ""
          "guacd-port"= ""
          "guacd-encryption"= ""
          "guacd-hostname"= ""
        }
    }
    New-GuacConnection -DataSource mysql -Parameters $RDPParameters

Remove a connection

Remove-GuacConnection -DataSource mysql -ConnectionId 74

Retrieving all connections groups

Get-GuacConnectionsGroups -DataSource mysql

Retrieving all active connections

Get-GuacActiveConnections -DataSource mysql

Functions

ConnectionGroups

  • Get-GuacConnectionsGroup
  • Get-GuacConnectionsGroupDetails
  • Get-GuacConnectionsGroups
  • Get-GuacConnectionsGroupsConnections
  • New-GuacConnectionGroup
  • Remove-GuacConnectionGroup
  • Update-GuacConnectionGroup

Connections

  • Get-GuacActiveConnections
  • Get-GuacConnection
  • Get-GuacConnections
  • New-GuacConnection
  • Remove-GuacConnection
  • Stop-GuacConnection
  • Update-GuacConnection

History

  • Get-GuacConnectionsHistory
  • Get-GuacUsersHistory

Languages

  • Get-GuacLanguages

Patch

  • Get-GuacPatches

Permissions

  • Add-GuacConnectionGroupMember
  • Add-GuacSystemPermission
  • Remove-GuacConnectionGroupMember
  • Remove-GuacSystemPermission

Schemas

  • Get-GuacSchemaConnection
  • Get-GuacSchemaConnectionGroup
  • Get-GuacSchemaProtocols
  • Get-GuacSchemaSharingProfile
  • Get-GuacSchemaUser

SharingProfiles

  • Get-GuacSharingProfile
  • Get-GuacSharingProfiles
  • New-GuacSharingProfile
  • Remove-GuacSharingProfile

Token

  • New-GuacToken
  • Remove-GuacToken

Tunnels

  • Get-GuacTunnel
  • Get-GuacTunnels

UserGroups

  • Add-GuacUserGroupConnection
  • Add-GuacUserGroupMember
  • Add-GuacUserGroupPermission
  • Get-GuacUserGroup
  • Get-GuacUserGroups
  • New-GuacUserGroup
  • Remove-GuacUserGroup
  • Remove-GuacUserGroupConnection
  • Remove-GuacUserGroupPermission
  • Update-GuacUserGroup
  • Update-GuacUserGroupParent

Users

  • Add-GuacUserConnection
  • Get-GuacUser
  • Get-GuacUsers
  • New-GuacUser
  • Remove-GuacUser
  • Remove-GuacUserConnection
  • Update-GuacUser
  • Update-GuacUserPassword

Author

Author: UpperM