This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This script queries the EMS API for all bookings in all rooms in all buildings for the next calendar year. | |
#It requires the EMS Read-Only API and an authorised user on the EMS database. | |
#Date math | |
$today = Get-Date | |
$lastYear = $today.AddYears(-1) | |
$nextYear = $today.AddYears(1) | |
$todayString = $today.ToString("MMMM dd, yyyy") | |
$lastYearString = $lastYear.ToString("MMMM dd, yyyy") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#O365 Global Admin Credentials stored as environmental variables. | |
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $env:O365Admin_Username,(ConvertTo-SecureString -AsPlainText -Force -String $env:O365Admin_Password) | |
$SCCSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $cred -Authentication Basic –AllowRedirection | |
Write-Host "Connecting to Compliance Center..." | |
Import-PSSession $SCCSession |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[ValidateSet('True','False')][String]$rps | |
) | |
#O365 Global Admin Credentials stored as environmental variables. | |
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $env:O365Admin_Username,(ConvertTo-SecureString -AsPlainText -Force -String $env:O365Admin_Password) | |
switch($rps){ | |
'True' { | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/?proxymethod=rps -Credential $cred -Authentication Basic -AllowRedirection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true)][Int32]$ticketID, | |
[Parameter(Mandatory=$true)][Int32]$fieldID, | |
[Parameter(Mandatory=$true)][string]$fieldValue | |
) | |
#Zendesk API Connection Headers Referencing System Environmental Variables for username and API token. | |
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($env:ZendeskAPI_Username):$($env:ZendeskAPI_Token)"));} | |
#Zendesk API: Update Ticket |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Download all admin and agent user objects from Zendesk. | |
$agents = &ZendeskAPI-GetZendeskUsers.ps1 "allagents" | |
#Trim agent list. | |
$agents = $agents | where email -like "*@yourdomain.com" | sort email | |
#Connect to Exchange Online. Use your own script here or swap this line out with the connection commands supplied by Microsoft. | |
#There's no reason this won't work with Exchange On-Prem AFAIK. We just use Exchange Online, so the comments reference it. | |
&ConnectToExchangeOnline.ps1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[ValidateSet('admin', 'agents', 'allagents', 'endusers', 'allusers')][String]$role | |
) | |
#Zendesk API Connection Headers Referencing System Environmental Variables for username and API token. | |
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($env:ZendeskAPI_Username):$($env:ZendeskAPI_Token)"));} | |
#GET ALL ZENDESK USERS | |
$allUsers = @() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true)][Int32]$ticketID, | |
[Parameter(Mandatory=$true)][String]$body, | |
[Parameter(Mandatory=$true)][ValidateSet('rich', 'html')][String]$body_type, | |
[Parameter(Mandatory=$true)][ValidateSet('private', 'public')][string]$scope, | |
[String][ValidateSet('assignee', 'apiuser')]$author | |
) | |
if($body_type -eq "html"){ | |
$zd_body_type = "html_body" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true)][String]$userID | |
) | |
#Zendesk API Connection Headers Referencing System Environmental Variables for username and API token. | |
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($env:ZendeskAPI_Username):$($env:ZendeskAPI_Token)"));} | |
$userURI = "https://yourdomain.zendesk.com/api/v2/users/$userID.json" | |
$user = Invoke-RestMethod -Uri $userURI -Method Get -Headers $headers -ContentType "application/json" | |
$user = $user.user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true)][Int32]$ticketID | |
) | |
#Zendesk API Connection Headers Referencing System Environmental Variables for username and API token. | |
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($env:ZendeskAPI_Username):$($env:ZendeskAPI_Token)"));} | |
$ticketsURI = "https://yourdomain.zendesk.com/api/v2/tickets/$ticketID.json" | |
$ticket = Invoke-RestMethod -Uri $ticketsURI -Method Get -Headers $headers -ContentType "application/json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory=$true)][Int32]$ticketID, | |
[Parameter(Mandatory=$true)][ValidateSet('open', 'pending', 'on-hold', 'solved')][String]$ticketStatus | |
) | |
#Zendesk API Connection Headers Referencing System Environmental Variables for username and API token. | |
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($ZendeskAPI_Username):$($ZendeskAPI_Token)"));} | |
#Zendesk API: Update Ticket | |
$uri = "https://yourdomain.zendesk.com/api/v2/tickets/$ticketID.json" |