Skip to content

Instantly share code, notes, and snippets.

View AndySchneiderDev-zz's full-sized avatar

Andy Schneider AndySchneiderDev-zz

View GitHub Profile
@AndySchneiderDev-zz
AndySchneiderDev-zz / ShowSessionState.ps1
Last active August 29, 2015 14:22
PowerShell Session State Demonstration
function Show-SessionStateDemo
{
[CmdletBinding()]
param (
[Parameter()]
$Server,
[Parameter()]
$Database,
@AndySchneiderDev-zz
AndySchneiderDev-zz / Update-Schema.ps1
Last active June 19, 2018 18:55
PowerShell to Udpate Active Directory Schema
# This should only be used in a development environment and is for demonstration purposes only
# Use at your own risk
# This adds an attribute to the user class
# Written by Andy Schneider, http://get-powershell.com
Function New-OID {
$Prefix="1.2.840.113556.1.8000.2554"
$GUID=[System.Guid]::NewGuid().ToString()
$Parts=@()
$Parts+=[UInt64]::Parse($guid.SubString(0,4),"AllowHexSpecifier")
@AndySchneiderDev-zz
AndySchneiderDev-zz / ADCompleters.ps1
Created January 10, 2015 20:37
TabExpansionPlusPlus for AD Users and Groups
function ADuserCompletion {
[ArgumentCompleter(
Parameter = 'Identity',
Command = { Get-CommandWithParameter -Module ActiveDirectory -Noun ADUser -ParameterName Identity },
Description = 'Complete AD Users')]
param($commandName,$parameterName,$wordToComplete,$commandAst,$fakeBoundParameter)
if ($wordToComplete -eq "") {$filter = "(ObjectClass=User)"}
else {$filter = "(&(ObjectClass=User)(ANR=$wordToComplete))"}
Get-ADuser -LDAPFilter $filter | sort SamAccountname |