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 / 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
@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 / Word2013.css
Created December 16, 2015 21:54
Word/Excel 2013 CSS style for Powershell ConvertTo-HTML
*
{
font-family:Calibri,sans-serif;
font-size:11pt;
}
p
{
margin:0 0 8pt;
}
td p
@JustinGrote
JustinGrote / Get-WinEventXPathFilter.ps1
Last active October 4, 2023 14:55
Get-WinEventXPathFilter
Function Get-WinEventXPathFilter
{
<#
.SYNOPSIS
This function generates an xpath filter that can be used with the -FilterXPath
parameter of Get-WinEvent. It may also be used inside the <Select></Select tags
of a Custom View in Event Viewer.
.DESCRIPTION
This function generates an xpath filter that can be used with the -FilterXPath
parameter of Get-WinEvent. It may also be used inside the <Select></Select tags
@JustinGrote
JustinGrote / ManageableDevice.tests.ps1
Last active August 17, 2022 12:37
Manageable Device Pester Tests
#requires -module Pester,PoshRSJob,SharpSNMP
<#
.SYNOPSIS
A set of Pester Tests for determining if a device is remotely manageable.
#>
#region Params
param (
@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 <[email protected]>
(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 <[email protected]>
#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 / Get-AllLocalGroupAdmins.ps1
Created May 27, 2016 23:12
Get-AllLocalGroupAdmins - Get Active Computers in AD and return the local Administrator group membership. Report as Excel.
#requires -version 5.0
<#
.SYNOPSIS
Finds active computers in AD and collects a list of their group memberships
#>
param (
#Path to output the resulting Excel Report
[String]$Path = "LocalAdminGroupReport-$(get-date -format yyyyhhmmss).xlsx",