Skip to content

Instantly share code, notes, and snippets.

View sob's full-sized avatar

Sean O'Brien sob

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sob on github.
  • I am sob (https://keybase.io/sob) on keybase.
  • I have a public key ASAnC6EkrjlQOGMu8b5X_Xt98aj2X1p7Sf8RJdlTmhkEQgo

To claim this, I am signing this object:

$freshmen = Get-AzureADUser -All $true | Where-Object {$_.Mail -like '*2024@my.corpuschristisaints.org'}
$freshmen | ForEach-Object {
Write-Host "Removing User " $_.UserPrincipalName "..."
Write-Host -NoNewline -ForegroundColor DarkGreen "- Removing Licenses "
$licenses = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses
$licenses.AddLicenses = @()
$licenses.RemoveLicenses = (Get-AzureADSubscribedSku | Where-Object -Property SkuPartNumber -Value "M365EDU_A3_STUUSEBNFT" -EQ).SkuID
Set-AzureADUserLicense -ObjectId $_.UserPrincipalName -AssignedLicenses $licenses
Write-Host -ForegroundColor Green " done!"
Import-Module MSOnline
Import-Module AzureAD
Import-Module ExchangeOnlineManagement
$mailboxList = Import-Csv -Path '.\mailboxes.csv'
function CountDown() {
param($timeSpan)
while($timeSpan -gt 0) {
#
# Fixes the SUrface Book 2 Intel Video adataper after dock / undock with Microsoft Surface Dock
# NOTE: same issue appeared on my original Surface Book but this is untested there.
#
# get the id and security principal of the current user
$myWindowsId = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the administrator role
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-US</UILanguageFallback>
### Keybase proof
I hereby claim:
* I am sob on github.
* I am sob (https://keybase.io/sob) on keybase.
* I have a public key ASCC0JZpq0JxkzXfKXnGxe9bQ7cWOkVR4DsxgPf1cg4CTQo
To claim this, I am signing this object:
@sob
sob / 01-ChangeUPN.ps1
Last active June 28, 2017 15:42
Remove vanity domain from O365
Get-MsolUser | ForEach-Object { $upn = $_.UserPrincipalName.Split("@")[0] + "@holytrinityschools.onmicrosoft.com"; Set-MsolUserPrincipalName -ObjectId $_.ObjectId -NewUserPrincipalName ($upn) }
Connect-AzureAD
Get-AzureADUser -Filter "UserType eq 'Member'" | Export-CSV C:\users.csv
Get-AzureADGroup | Export-CSV C:\groups.csv
Import-CSV C:\Users.csv | Remove-AzureADUser
Import-CSV C:\Groups.csv | Remove-AzureADGroup
Connect-AzureAD
Get-AzureADUser -All | Export-CSV C:\users.csv
Get-AzureADGroup -All | Export-CSV C:\groups.csv
Import-CSV C:\Users.csv | Remove-AzureADUser -Force
Import-CSV C:\Groups.csv | Remove-AzureADGroup -Force
@sob
sob / .bashrc
Created April 17, 2017 19:12 — forked from jeremytwfortune/.bashrc
WSL Configuration
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac