Skip to content

Instantly share code, notes, and snippets.


Brian T. Jackett BrianTJackett

View GitHub Profile
BrianTJackett / PS-WinGet_Apps_To_Install.ps1
Last active Sep 19, 2020
Script for re-installing applications via winget to new machine
View PS-WinGet_Apps_To_Install.ps1
winget install Microsoft.dotnet
winget install Microsoft.PowerShell
winget install Microsoft.WindowsTerminal
winget install Postman.Postman
winget install Notepad++.Notepad++
winget install Telerik.Fiddler
winget install Microsoft.VisualStudioCode
winget install Microsoft.VisualStudio.Enterprise
winget install Microsoft.Powertoys
winget install microsoft.mousewithoutborder
BrianTJackett / EXO-New_SCCeDiscoveryCaseAndHold.ps1
Last active Sep 13, 2020
Create an Office 365 Security and Compliance Center eDiscovery case, hold, and content search. Warning: uses basic authentication which will be deprecated in Oct 2020.
View EXO-New_SCCeDiscoveryCaseAndHold.ps1
Set-StrictMode -Version "Latest"
# eDiscovery case creation
$caseName = 'Smith v. Johnson';
$UPN = '', ''
$description = "$caseName"
$policyName = "$caseName - Hold Policy"
$ruleName = "$caseName - Hold Rule"
$searchName = "$caseName - Search Name"
$rootFolderNameQuery = "Legal Hold"
BrianTJackett / PS-O365_admin_creds.ps1
Created Nov 15, 2019
This snippet will store credentials for 2 different accounts encrypted to disk. They will then be loaded into PSCredentials as global variables. Place this in your profile for automatic loading.
View PS-O365_admin_creds.ps1
New-PSDrive -Name Scripts -PSProvider FileSystem -Root <folderLocationOfScriptsGoesHere>
#read-host -AsSecureString -Prompt "Enter O365 password 1" | ConvertFrom-SecureString | set-content scripts:\O365AdminPassword1.txt
#read-host -AsSecureString -Prompt "Enter O365 password 2" | ConvertFrom-SecureString | set-content scripts:\O365AdminPassword2.txt
function Import-O365AdminCredential
$smtpAddress1 = ""
$CredsFile1 = "Scripts:\O365AdminPassword1.txt"
BrianTJackett / WT-profiles.json
Last active Jul 20, 2020
Windows Terminal settings.json file with included shells (profiles) for PowerShell v7, Zsh, and more.
View WT-profiles.json
// This file was initially generated by Windows Terminal 1.0.1811.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see:
"$schema": "",
BrianTJackett / PS-Get_PowerApps_App_Connections.ps1
Created Mar 14, 2019
Iterate through all environments and get all PowerApps apps and the connections they use.
View PS-Get_PowerApps_App_Connections.ps1
$environments = Get-PowerAppEnvironment
foreach($environ in $environments.EnvironmentName)
$apps = Get-AdminPowerApp -EnvironmentName $environ
$apps | Add-Member -MemberType ScriptProperty -Name Connections -Value {$} -Force
$apps | Select-Object AppName, DisplayName, Connections
View CS-Graph_Request_Users_GraphServiceClient.cs
var graphResult = graphClient.Users.Request().GetAsync().Result;
BrianTJackett / CS-Graph_Class_MsalAuthenticationProvider.cs
Last active Oct 7, 2019
Microsoft Graph create class to handle authentication with Azure AD and use access token on subsequent requests.
View CS-Graph_Class_MsalAuthenticationProvider.cs
public class MsalAuthenticationProvider : IAuthenticationProvider
private IConfidentialClientApplication _clientApplication;
private string[] _scopes;
public MsalAuthenticationProvider(IConfidentialClientApplication clientApplication, string[] scopes) {
_clientApplication = clientApplication;
_scopes = scopes;
BrianTJackett / CS-Graph_Prepare_GraphServiceClient.cs
Last active Oct 7, 2019
Microsoft Graph C# .Net Core prepare GraphServiceClient
View CS-Graph_Prepare_GraphServiceClient.cs
var clientId = "<AzureADAppClientId>";
var clientSecret = "<AzureADAppClientSecret>";
var redirectUri = "<AzureADAppRedirectUri>";
var authority = "<AzureADAppTenantId>/v2.0";
var cca = ConfidentialClientApplicationBuilder.Create(clientId)
BrianTJackett / PS-Get_All_Sites_SPO.ps1
Created Jul 31, 2018
Get all sites from SharePoint Online using SPO Management Shell commands.
View PS-Get_All_Sites_SPO.ps1
Connect-SPOService -Url '<tenantAdminUrl>'
Get-SPOSite -Limit all -IncludePersonalSite $true
BrianTJackett / CS-CSOM_Traverse_All_Sites_SPO.txt
Last active Jul 1, 2019
Traverse all sites in SharePoint Online using C# CSOM.
View CS-CSOM_Traverse_All_Sites_SPO.txt
List <SiteProperties> list = new List <SiteProperties>();
SPOSitePropertiesEnumerable ssp = null;
SPOSitePropertiesEnumerableFilter sspFilter = new SPOSitePropertiesEnumerableFilter();
SharePointOnlineCredentials creds = new SharePointOnlineCredentials("myUsernameGoesHere", securePassword);
using (ClientContext cc = new ClientContext("myURLGoesHere"))
cc.Credentials = creds;