Skip to content

Instantly share code, notes, and snippets.

View pkskelly's full-sized avatar

Pete Skelly pkskelly

View GitHub Profile
pkskelly / Get-GuestUsers.ps1
Created December 20, 2021 19:23
The Get-GuestUsers.ps1 script inventories Guest accounts and Sign In Activity from Azure AD into a SharePoint Online List.
#!/usr/local/bin/pwsh -File
The Get-GuestUsers.ps1 script inventories Guest accounts and Sign In Activity from Azure AD into a SharePoint Online List.
The Get-GuestUsers.ps1 script inventories Guest accounts from Active Directory using the CLI for M365
and PowerShell's Invoke-RestMethod to query Microsoft Graph for a all Guest accounts and signInActivity.
The script can also gather Teams that the Guest account is a member of by inclusing the -InlcudeTeams switch.
pkskelly / Get-FlowOwners.ps1
Last active March 1, 2021 19:39
PowerShell Core script that retrieves and exports Flows and Owner information to CSV file
#!/usr/local/bin/pwsh -File
$DIR = Split-Path $script:MyInvocation.MyCommand.Path
$TMP_DIR = "./tmp"
$FLOWSCSV_SUFFIX = "-flows.csv"
$ALLFLOWSCSV = "allflows.csv"
function CleanDistFolder {
# Remove the dist folder as needed
if (Test-Path -Path "$TMP_DIR" -PathType Container) {
pkskelly / VSCodeTerminalKeybindings.json
Last active January 27, 2020 20:27
VS Code Terminal Keybindings to enable Ctrl+` to switch back to the editor and Shift+Cmd+] to move between active terminal sessions. Press cmd+shift+p and type keyboard to find Preferences: Open Keyboard Shortcuts File. Add the following to the keybindings.json or update the existing file and save it.
// Place your key bindings in this file to override the defaults
// Toggle to terminal focus
"key": "ctrl+`",
"command": "workbench.action.terminal.focus"
// Toggle to editor focus
"key": "ctrl+`",
pkskelly /
Last active August 13, 2019 20:47
Shell script using Office 365 CLI v2 to group enable and connect a MS Team to an existing SharePoint Online classic team site.
#!/usr/bin/env bash
help() {
echo " ****************************************************************"
echo " ** Teamify Classic Site "
echo " ** "
echo " ** Simple script to Groupify and Teamify a SharePoint Online Classic site"
echo " ** "
echo " ** Usage: ./ -s|--siteUrl [classic site url] -a|--alias [alias] -d|--description [description]"
pkskelly / Get-MFAStatus.ps1
Last active May 17, 2019 19:20
List Users MFA Status for All Users
Get-MsolUser -all |
Select-Object ObjectId, IsLicensed, DisplayName, UserPrincipalName, BlockCredential, UserType, WhenCreated, LastPasswordChangeTimestamp,LicenseReconciliationNeeded,
@{N = "Type"; E = { if ( $_.UserPrincipalName.IndexOf("#EXT#") -gt 0 ) { "External" } else { "ThreeWill" } } } ,
@{N = "MFAStatus"; E = { if ( $_.StrongAuthenticationRequirements.State -ne $null) { $_.StrongAuthenticationRequirements.State } else { "Disabled" } } } ,
@{N = "ConferenceRoom"; E = { if ( ($_.UserPrincipalName).IndexOf("conference") -gt 0) { $true } else { $false } } } ,
@{N = "ThreatLevel";
E = {
pkskelly /
Last active October 20, 2020 12:28
Script to update the SSL certificate for the URL Shortener (or any Azure Web App)
thumbprint=$(az webapp config ssl upload \
--name $APP_NAME \
--resource-group $RESOURCE_GROUP \
--certificate-file $CERT_FILE \
pkskelly /
Last active April 23, 2020 01:56
Bash script using Office 365 CLI and jq to create a csv report of Flow with mapped Owner details
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
pkskelly / merge.jq
Last active April 23, 2020 01:57
Merge jq module to merge MS Flow JSON output with Azure AD user information
# Create a dictionary based on the $ property from the owners array parameter
($owners | map(select(.id != null)) | map( {(.id): {displayName, userPrincipalName, mail}}) | add) as $dict
# Output each flow and append the the owner information from each dictionary entry
# using the flow's creator.userId property as the key
| $flows |.[].properties.creator |= . + $dict[.userId]
pkskelly /
Created May 9, 2018 17:57
Template for HubSite REST Calls. You can copy this file, load the REST Client Extension in VS Code and run the samples. Some configuration and knowledge of OAuth is required.

@host = tenant-name @hubname = hubsite-name @token = Bearer bearer-toekn-value @hubid = hub-id @spokeid = spoke-id @company = your-company

### CanCreate - determine if current user can create a hubsite GET https://{{host}} Accept: application/json

pkskelly /
Created December 22, 2017 01:51
Azure CLI script to remove Blob storage containers serving Angular static files.
while getopts "a:k:" opt; do
case $opt in