Skip to content

Instantly share code, notes, and snippets.

View pkskelly's full-sized avatar

Pete Skelly pkskelly

View GitHub Profile
@pkskelly
pkskelly / Get-MFAStatus.ps1
Last active May 17, 2019 19:20
List Users MFA Status for All Users
#Connect-MsolService
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
pkskelly / configureNGStorage.sh
Created December 22, 2017 01:46
Azure CLI script to enable Blob storage containers to serve Angular static files.
#!/bin/bash
AZURE_STORAGE_ACCOUNT=""
AZURE_STORAGE_ACCESS_KEY=""
while getopts "a:k:" opt; do
case $opt in
a)
AZURE_STORAGE_ACCOUNT="${OPTARG}"
;;
@pkskelly
pkskelly / O365Logout.html
Last active January 15, 2019 11:17
Link to log out of Office 365 or SharePoint 2013. Simply copy this file locally, open in a browser and drag the link to the bookmarks bar. Clicking the book mark will force a log out.
<html>
<head>
<title>Logout</title>
</head>
<!-- See http://blog.credera.com/technology-insights/microsoft-solutions/how-to-sign-in-as-a-different-user-in-sharepoint-2013/ for original script-->
<body>
<a href="javascript:
(function()
{
if (typeof SP !== 'undefined')
@pkskelly
pkskelly / hubsites.rest
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}}-admin.sharepoint.com/_api/sp.hubsites.cancreate Accept: application/json

@pkskelly
pkskelly / removeNGStorage.sh
Created December 22, 2017 01:51
Azure CLI script to remove Blob storage containers serving Angular static files.
#!/bin/bash
AZURE_STORAGE_ACCOUNT=""
AZURE_STORAGE_ACCESS_KEY=""
while getopts "a:k:" opt; do
case $opt in
a)
AZURE_STORAGE_ACCOUNT="${OPTARG}"
;;
@pkskelly
pkskelly / SMATCollector.ps1
Created July 3, 2017 18:11
Simple Script to combine all SMAT CSV files into a single file
$csvFiles = Get-ChildItem $PSScriptRoot -Include *.csv -Recurse
$fileCount = $csvFiles.Count
Write-Host "Processing files: ($fileCount)"
foreach ($csv in $csvFiles) {
Write-Host "Processing $($csv.BaseName)..."
}
$outputfilename = read-host "Please enter the output file name"
@pkskelly
pkskelly / Clear-SPListItems.ps1
Last active May 19, 2017 14:17
Clear-SPListItems.ps1 simulates SPWeb.ProcessBatchData() using CSOM to batch ListItemCollection item deletes. Feedback welcome! To see what is going on under the covers, run Fiddler and watch the traffic for the requests.
# =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Script: Clear-SPListItems.ps1
#
# Author: Pete Skelly
# Twitter: ThreeWillLabs
# http://www.threewill.com
#
# Description: Purge list in Sharepoint Online - Office 365 using CSOM by
# batching CSOM calls to simulate SPWeb.ProcessBatchData().
#
@pkskelly
pkskelly / createproj.sh
Last active March 27, 2017 12:54
Simple .NET Core CLI set of commands to create a solution with referenced projects on a Mac.
#create the solution
dotnet new sln -n CandidateManager
#create the Console project
dotnet new console --name CandidatesConsole --output CandidatesConsole
#create the web project
dotnet new webapi --name CandidatesWeb --output CandidatesWeb
# These are the templates available from ASP.NET JavaScript Services https://github.com/aspnet/JavaScriptServices
@pkskelly
pkskelly / Add-SPListItemsFromCSV.ps1
Last active October 12, 2015 15:07
Add list items to SharePoint Online - Office 365 List using CSOM from CSV file.
# =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Script: Add-SPListItemsFromCSV.ps1
#
# Author: Pete Skelly
# Twitter: ThreeWillLabs
# http://www.threewill.com
#
# Description: Add list items to SharePoint Online - Office 365 List using CSOM from CSV file.
#
# WARNING: Script provided AS IS with no warranty. Your mileage will vary. Use
@pkskelly
pkskelly / SplitPascalCaseVIewNames
Created June 19, 2015 20:34
Extension Method to walk all views in all lists and expand PascalCase view names. E.g. expand "AllItems" to "All Items" in order to keep the %20 chars out of the Url
public static partial class WebExtensions
{
public static void SplitPascalCasedViewNames(this Web web)
{
ListCollection projectLists = web.Lists;
web.Context.Load(projectLists);
web.Context.ExecuteQuery();
foreach (List list in projectLists)
{
ViewCollection listViews = list.Views;