Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions prtgshell.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@
## API Functions
###############################################################################

function Get-PrtgPassHash {
<#
.SYNOPSIS
Obtains a Pass hash to be able to connect to the PRTG server to call the API. For example in Get-PrtgServer
You can request the password hash for an account with an API call:
http://yourserver/api/getpasshash.htm?username=myuser&password=mypassword
.DESCRIPTION
The Get-PrtgPassHash cmdlet connects to the PRTG server over HTTPS and The cmdlet needs at three parameters:
- The server name (without the protocol)
- An authenticated username
- A password
Return Value is a String which is the password hash.
.EXAMPLE
Get-PrtgPassHash "prtg.company.com" "jsmith" "mysecurepassword"
Connects to PRTG using the default port (443) over SSL (HTTPS) using the username "jsmith" and the password mysecurepassword

.PARAMETER Server
Fully-qualified domain name for the PRTG server. Don't include the protocol part ("https://" or "http://").

.PARAMETER UserName
PRTG username to use for authentication to the API.

.PARAMETER Password
PRTG password to use to obtain the PassHash.
#>
Param (
[Parameter(Mandatory=$True,Position=1)]
[string]$Server,

[Parameter(Mandatory=$True,Position=2)]
[string]$UserName,

[Parameter(Mandatory=$True,Position=3)]
[securestring]$Password
)
$PassHash = Invoke-RestMethod -Uri https://$Server/api/getpasshash.htm?Username=$UserName"&"password=$Password

Return $PassHash
}

function Get-PrtgServer {
<#
.SYNOPSIS
Expand Down