Skip to content

Instantly share code, notes, and snippets.

################################################################################################################################################################
# To run the script
#
# .\Get-MailBoxSizesOU.ps1
#
# NOTE: If you do not pass an input file to the script, it will return the sizes of ALL mailboxes in the tenant. Not advisable for tenants with large
# user count (< 3,000)
#
#Supports Modern Authentication and Multi Factor Authenication
#Dependenices: Exchange Online Module
@warfighter8
warfighter8 / toast.ps1
Created June 29, 2018 14:29
sample powershell for windows 10 toast notifications
$app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
$Template = [Windows.UI.Notifications.ToastTemplateType]::ToastImageAndText01
#Gets the Template XML so we can manipulate the values
[xml]$ToastTemplate = ([Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($Template).GetXml())
[xml]$ToastTemplate = @"
<toast launch="app-defined-string">
@warfighter8
warfighter8 / activateOEM.ps1
Last active June 7, 2018 18:02
Script to activate a Windows 10 PC using the OEM key embedded in UEFI
#Script to activate the PC using the OEM key embedded in the Bios
#Author: Terry Wensel
#Last Updated: 6/7/2018
#Uncomment the following part to check for administrator privileges
#param([switch]$Elevated)
#
#Function Test-Admin {
# $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
@warfighter8
warfighter8 / ForwarindInboxRules01.ps1
Created May 24, 2018 19:46
Get Mailboxes with forwarding inbox rules
$users = (get-mailbox -resultsize unlimited).UserPrincipalName
foreach ($user in $users)
{
Get-InboxRule -Mailbox $user | Select-Object MailboxOwnerID,Name,Description,Enabled,RedirectTo, MoveToFolder,ForwardTo | Export-CSV C:\temp\testing.csv -NoTypeInformation -Append
}
<#
.SYNOPSIS
Creates an HTML monster report for ALL Domain Controllers in the domain.
.DESCRIPTION
Script - Not fully containted, need to Import ActiveDirectory
Script meant to run on an "admin server" with AD tools installed
Script is meant to be run from a scheduled task but can be run standalone
Script will take a long time (1 - 3 hours) depending on size for domain.
@warfighter8
warfighter8 / useraccountcreation.ps1
Last active October 2, 2018 12:18
Allows creation of AD user accounts with powershell.
# This form will create an account based upon the information provided in the fields.
# After clicking "Create" it will prompt for a password in the original powershell window (should still be open in the background.
# Once the account is created it will be set to "Smart Card Required" using the upn field followed by "@company"
# This can be changed by changing "SmartCardLogonRequired" to $false. Note if you leave it enabled and then uncheck it manually you will have to reset their password
# Set up the form ========================================================= ==
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Original Version: 1.4, 2016-01-16
# Tweaked based on personal preferences for @alirobe 2016-03-23 - v1.4.1
# NOTE: MAKE SURE YOU READ THIS SCRIPT CAREFULLY BEFORE RUNNING IT + ADJUST COMMENTING AS APPROPRIATE
# This script will reboot your machine when completed.
##########
# Ask for elevated permissions if required
@warfighter8
warfighter8 / All-In-One.ps1
Last active June 17, 2016 01:03
Automated Admin privilege, Setup windows 10 startmenu from xml, setup default app associations, remove all but whitelisted apps from current user, remove all but whitelisted apps for default user, and reset unsigned powershell script permissions.
param([switch]$Elevated)
function Test-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
if ((Test-Admin) -eq $false) {
if ($elevated)
{