Skip to content

Instantly share code, notes, and snippets.

View JustinGrote's full-sized avatar

Justin Grote JustinGrote

View GitHub Profile
@JustinGrote
JustinGrote / Get-ADSensitiveUser.ps1
Created November 19, 2015 01:12
Get a list of AD users based on group membership or title
$groups = “Domain Admins”,”Enterprise Admins”
$titles = “Director”,”Chief”,”Executive”
$users = Foreach ($title in $titles) {
$titlefilter = "*$title*"
Get-aduser –filter {title -like $titlefilter} -properties title
}
$users += Foreach ($group in $groups) {
$groupdn = (get-adgroup $group).distinguishedname
@JustinGrote
JustinGrote / Office365ISEQuickConnect.ps1
Last active November 27, 2015 00:39
Adds a submenu and keyboard shortcuts to Powershell ISE for quickly connecting to Office 365 services including on-premises Exchange and importing the commands into your current session.
<#
HOW TO INSTALL
Open your Powershell ISE Profile (when in the ISE type psedit $profile) and either paste this content into it and save, or dot source the file wherever you saved it.
Use Get-Help about_Scripts for more info on dot sourcing
#>
#Microsoft O365 Menu Items
New-Variable -name O365ISECREDENTIAL -scope Script
@JustinGrote
JustinGrote / Start-AADFullPasswordSync.ps1
Created December 11, 2015 18:56
Start-AADFullPasswordSync
$adConnector = (get-addomain).dnsroot
$aadConnector = (get-adsyncconnector | where {$_.subtype -match "Windows Azure Active Directory"})[0].name
Import-Module adsync
$c = Get-ADSyncConnector -Name $adConnector
$p = New-Object Microsoft.IdentityManagement.PowerShell.ObjectModel.ConfigurationParameter "Microsoft.Synchronize.ForceFullPasswordSync", String, ConnectorGlobal, $null, $null, $null
@JustinGrote
JustinGrote / ShowOnlyLatestTaskNotes.js
Last active April 16, 2016 10:19
Sharepoint CSR JSLink to summarize task notes
// This is a Sharepoint jsLink file that will render the description field (known internally as Body)
// in a Task List view as simply the last line in the multiline field.
// Useful for showing only the latest activity on a task summary sheet.
// Written 2016-02-02 by Justin Grote <justin@grote.name>
(function () {
// Create object that have the context information about the field that we want to change it's output render
var bodyFieldContext = {};
@JustinGrote
JustinGrote / cache_destage_acd.sh
Last active June 7, 2016 00:55
Destage Files to Another File System using High/Low Watermark Method
#!/bin/bash
#Cache Destaging Script
#Author: Justin Grote <justin@grote.name>
#License: MIT
#Synopsis: Move files from one directory to another when a high watermark is reached
#This was written to move Plex files from a fast SSD cache to a slower speed cloud storage
#on an automatic basis. It uses FIFO logic, the oldest file in the cache is the first to be destaged
#This is designed to run as a cron job, recommend run every 5 minutes as the script will ensure only
@JustinGrote
JustinGrote / solusvm_monitor.py
Created July 4, 2016 21:05
SolusVM Monitor Alert
#!/usr/bin/env python3
###DESCRIPTION
#This script sends an email alert when a specific SolusVM metric
#exceeds its monitor
###USAGE
#solusvm_monitor.py <metric> <monitor>
#Metric: One of hdd, bw, or mem. Default is bw
#Monitor: Threshold to alert when exceeded. Default is 80
@JustinGrote
JustinGrote / Format-ExchangeMessageTrace.ps1
Created August 15, 2016 22:47
Exchange Extended Message Trace script to parse an Exchange Extended Message Trace into usable Powershell Objects
<#
.SYNOPSIS
Takes an Exchange Extended Message Trace and parses it into usable powershell objects
#>
[CmdletBinding()]
param (
#Path to the extended message trace CSV
[Parameter(Mandatory)][String[]]$CSVPath
)
@JustinGrote
JustinGrote / New-MailboxBatchMigrationCSV.ps1
Created August 5, 2016 05:31
Exchange Mailbox Batch Migration with Intelligent Mailbox Balancing
#requires -version 3.0
#requires -pssnapin Microsoft.Exchange.Management.PowerShell.E2010
<#
.SYNOPSIS
Generates a CSV that can be used with the BatchMigration process
.DESCRIPTION
This script generates a CSV from a list of mailboxes for local migrations. Its primary use is to allow for custom mailbox distribution methods, such as by least-full database or round-robin
This is primarily meant for greenfield migrations where all databases are of similar configuration, and not heterogeneous database environments.
.NOTES
@JustinGrote
JustinGrote / Get-ADSIEnabledComputer.ps1
Created December 1, 2016 02:14
Get AD Computers using legacy ADSI Interface (Useful for Windows 2003 and areas where AD Web Services is not available for Get-ADComputer)
<#
.EXAMPLE
Get Enabled Computers from a domain in another environment
Get-ADSIEnabledComputer -connectionstring 'LDAP://myserver1.contoso.com/DC=contoso,dc=com' -username "admin" -password "Password@1307"
#>
#TODO: Convert Username/Password to PSCredential field for security
param (
@JustinGrote
JustinGrote / Expand-WinEvent.ps1
Last active July 5, 2017 14:00
Expand-WinEvent
function Expand-WinEvent {
<#
.SYNOPSIS
Configured EventLogRecords into EventLogExpandedRecords that are easier to parse
.DESCRIPTION
Convert eventRecords into a more parseable object format, including custom event properties
By expanding the Event XML data into individual properties, this makes WinEvents easier to work with and parse