Skip to content

Instantly share code, notes, and snippets.

View jdmills-edu's full-sized avatar

JD Mills jdmills-edu

View GitHub Profile
@jdmills-edu
jdmills-edu / admissions-ticker.markdown
Created September 19, 2019 20:39
Admissions Ticker
@jdmills-edu
jdmills-edu / ATP-ConvertSafelinkToUrl.ps1
Created January 25, 2018 20:35
Microsoft doesn't offer a commandlet that converts an Advanced Threat Protection (ATP) SafeLink into the real target URL. This short script uses the .NET UrlDecode function and RegEx to extract it.
<#
.SYNOPSIS
Converts a URL-encoded ATP Safelink to a real URL.
.DESCRIPTION
Microsoft doesn't offer a commandlet that converts an Advanced Threat Protection (ATP) SafeLink into the real target URL. This short script uses the .NET UrlDecode function and RegEx to extract it.
.PARAMETER safelink
A safelinks.protection.outlook.com link that includes the encoded target URL.
@jdmills-edu
jdmills-edu / QualtricsAPI-ListSurveys.ps1
Created October 10, 2017 02:55
A PowerShell script that lists all surveys accessible to a Qualtrics user with an API token.
#This Qualtrics API call only returns surveys accessible to the user holding the token, not all surveys in the tenant.
#Define headers and API endpoint.
$headers = @{
"X-API-TOKEN" = yourapitoken
}
$qualtrics_api_url = "https://yourdatacenter.qualtrics.com/API/v3"
$endpoint = "surveys"
$uri = $qualtrics_api_url+"/"+$endpoint
@jdmills-edu
jdmills-edu / QualtricsAPI-ListUsers.ps1
Created October 10, 2017 02:47
A PowerShell script that lists all users in a Qualtrics tenant. Supports pagination and filtering by user type.
param(
[ValidateSet("all","admins")][String]$type = "all"
)
#Define connection parameters and API endpoints
$headers = @{
"X-API-TOKEN" = yourapitokenhere
}
$qualtrics_api_url = "https://yourdatacenter.qualtrics.com/API/v3"
@jdmills-edu
jdmills-edu / StatusPageAPI-Metric-SubmitDataPoint.ps1
Last active September 21, 2017 19:40
A PowerShell script that adds a data point to a StatusPage.io public metric.
param(
[Parameter(Mandatory=$true)][String]$metric_id,
[Parameter(Mandatory=$true)][Float]$datapoint
)
$api_key = YourStatusPageAPIKey
$page_id = YourStatusPagePageID
$api_base = 'https://api.statuspage.io/v1'
$metricURI = $api_base+"/pages/"+$page_id+"/metrics/"+$metric_id+"/data.json"
@jdmills-edu
jdmills-edu / TeamDynamixAPI-Authenticate.ps1
Created September 21, 2017 14:24
A PowerShell script that authenticates to the Team Dynamix API and returns a JSON Web Token. A prerequisite for any further queries to the TDX API.
$url = "https://yourdomain.teamdynamix.com/TDWebApi/api"
$action = "/auth/loginadmin"
$endpoint = $url+$action
$request = '{
"BEID": "YourTDXAPIBEID",
"WebServicesKey": "YourWebServicesKey"
}'
$jwt = Invoke-RestMethod -Method Post -Uri $endpoint -Body $request -ContentType "application/json; charset=utf-8"
@jdmills-edu
jdmills-edu / DropboxAPI-ListMembers.ps1
Created September 21, 2017 14:10
A PowerShell script that uses the Dropbox Business API to retrieve all users in your tenant. Supports pagination for large tenants.
#API token from https://www.dropbox.com/developers/apps
$token = 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
#Create initial DfB team members array:
$teammembers = Invoke-RestMethod -Uri https://api.dropbox.com/2/team/members/list -Body '{}' -ContentType "application/json; charset=utf-8" `
-Headers @{ Authorization = $token } -Method Post
$allDropboxUsers = $teammembers.members.profile
#Keep paginating until we get all the account members.
while($teammembers.has_more -eq "True"){
@jdmills-edu
jdmills-edu / DropboxAPI-StorageSpaceByTitle.ps1
Last active September 21, 2017 14:12
A PowerShell script that gathers storage space utilization for all users in your Dropbox Business tenant, grouped by Active Directory Title. This example is written for .edu's that use the Student/Staff/Faculty title schema, but you could modify the script to use any other title schema you prefer, or simply use it to collect the storage utilizat…
#Specify your Dropbox AD Group (the one you use with the AD Connector)
$DropboxADGroupName = "YourDropboxUsersADGroup"
#API token from https://www.dropbox.com/developers/apps
$token = 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
#Get Dropbox Users via the DfB API
$allDfBAPIUsers = &DropboxAPI-ListMembers.ps1
$allDfBAPIUsers = $allDfBAPIUsers | where team_member_id
$dfBAPIUsersFormatted = $allDfBAPIUsers | Select team_member_id, @{Name="Username";Expression={$_.email.split("@")[0]}}, email
@jdmills-edu
jdmills-edu / DropboxAPI-CreateTeamFoldersFromDeptGroups.ps1
Created September 21, 2017 13:58
A PowerShell script that checks a given OU for security groups, creating a new Team Folder if it finds a security group without a matching Team Folder. Useful for automatically creating Team Folders for every departmental security group in a given OU. Run this as a scheduled task.
$dfbToken = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
$ou = "OU=YourOU,DC=domain,DC=com"
$groups = Get-ADGroup -SearchBase $ou -Filter * | Sort Name
#List Team Folders
$headers = @{
Authorization = "Bearer $dfbToken"
}
$teamFolders = Invoke-RestMethod -Method Post -Uri https://api.dropboxapi.com/2/team/team_folder/list -Headers $headers -ContentType application/json -Body "{}"
$teamFolders = $teamFolders.team_folders.Name
@jdmills-edu
jdmills-edu / EMSAPI-GetBookingAtTime.ps1
Created September 21, 2017 13:47
A PowerShell script that uses the Dean Evans EMS API to return the list of bookings in a given room at a given time.
param(
[string]$building,
[string]$room,
[string]$time
)
$dateTime = $time | Get-Date
$dateString = $dateTime.ToString("yyyy-MM-ddThh:mm:ss")
#Define API connection parameters