Skip to content

Instantly share code, notes, and snippets.

View Nora-Ballard's full-sized avatar

Nora Ballard Nora-Ballard

View GitHub Profile
@Nora-Ballard
Nora-Ballard / DotGraph.psm1
Created July 27, 2014 13:54
Functions for creating Dot (graphviz) diagrams from Powershell.
function New-DotGraph {
param(
[Parameter(Mandatory)]
[string]$Name,
[Parameter()]
[ValidateSet('Letter','Legal','11x17')]
$PageSize,
@Nora-Ballard
Nora-Ballard / Clipboard.psm1
Created July 27, 2014 13:53
Function for getting the contents of the clipboard from Powershell, will try to identify the content and output the appropriate object; File paths as file objects, csv content as named properties, single column list as array, etc. Also contains useful functions for working with streams.
function New-PSObjectFromArrays {
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[array]$Values,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string[]]$PropertyNames
)
@Nora-Ballard
Nora-Ballard / DirectoryServices.psm1
Created July 27, 2014 13:48
Module of various functions for working with Directory Services in Powershell. Some of these capabilities are now available in the native AD module, however this module has the advantage of not requiring the web service to work, they use straight LDAP so they work with all domains, ADAM/ADLDS, and third party LDAP services.
function Select-DsEntry
{
param(
[Parameter(ParameterSetName='AutoQuery')]
[string]$Name = '*',
[Parameter(ParameterSetName='AutoQuery')]
[ValidateSet('User','Group','Computer','Organizational-Unit')]
[string]$ObjectCategory = '*',
@Nora-Ballard
Nora-Ballard / Get-GoogleShortURL.ps1
Created April 26, 2014 06:39
Shorten URL using goo.gl
function Get-GoogleShortURL {
param(
[Parameter(Mandatory, ValueFromPipeline)]
[ValidateScript({
[System.Uri]::TryCreate($_, [System.UriKind]::RelativeOrAbsolute , [ref]$_)
})]
[string]$longUrl
)
PROCESS
{
@Nora-Ballard
Nora-Ballard / Invoke-MailTo.ps1
Created April 24, 2014 03:19
Create new email in the default mail client, and optionally include an attachment.
function Invoke-MailTo {
param(
[OutputType([bool])]
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$To,
[Parameter(Mandatory)]
[string]$Subject,
@Nora-Ballard
Nora-Ballard / Set-WindowState.ps1
Last active July 5, 2025 20:55
Hide, Show, Minimize, Maximize, etc window from Powershell.
function Set-WindowState {
param(
[Parameter()]
[ValidateSet('FORCEMINIMIZE', 'HIDE', 'MAXIMIZE', 'MINIMIZE', 'RESTORE',
'SHOW', 'SHOWDEFAULT', 'SHOWMAXIMIZED', 'SHOWMINIMIZED',
'SHOWMINNOACTIVE', 'SHOWNA', 'SHOWNOACTIVATE', 'SHOWNORMAL')]
[Alias('Style')]
[String] $State = 'SHOW',
[Parameter(ValueFromPipelineByPropertyname='True')]
@Nora-Ballard
Nora-Ballard / Pushover.psm1
Last active August 29, 2015 14:00
Pushover.net Powershell Module for sending notification Messages to your phone. Requires you to generate an Application Token and provide your User Key from the Pushover.net site.
#Requires -Version 3
[CmdletBinding()]
param(
[Parameter()]
[string]$TokenFile = (Join-Path $env:LOCALAPPDATA 'PushoverModule_CachedToken.xml')
)
#region Functions
function ConvertTo-UnixDateTime {
param(
@Nora-Ballard
Nora-Ballard / Leopard_KerberosTicketFix.scpt
Last active August 29, 2015 13:56
Change Kerberos Renew Launch Agent to use -R instead of -B to fix an issue with tickets not renewing in Leopard.
-- Change Kerberos Renew Launch Agent to use -R instead of -B
-- Fixes an issue of tickets not renewing.
do shell script "defaults write /System/Library/LaunchAgents/com.apple.Kerberos.renew ProgramArguments -array '/usr/bin/kinit' '-R'" with administrator privileges
do shell script "chown root:wheel /System/Library/LaunchAgents/com.apple.Kerberos.renew.plist" with administrator privileges
do shell script "chmod +r /System/Library/LaunchAgents/com.apple.Kerberos.renew.plist" with administrator privileges
@Nora-Ballard
Nora-Ballard / OSX_SecurityConfig.scpt
Created February 20, 2014 22:46
Sets some basic security settings on OS X.
-- Security Control: Enable 'Use secure virtual memory'
do shell script "defaults write /Library/Preferences/com.apple.virtualMemory UseEncryptedSwap -bool yes" with administrator privileges
-- Security Control: Disable remote control infrared receiver
do shell script "defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool no" with administrator privileges
-- Security Control: Disable automatic login
do shell script "defaults write /Library/Preferences/.GlobalPreferences com.apple.autologout.AutologoutDelay -int 0" with administrator privileges
-- Security Control: Set the login options to display name and password in the login window.
@Nora-Ballard
Nora-Ballard / sAMAccountName.ldif
Created February 20, 2014 22:42
LDIF for adding sAMAccountName attribute to the directory. Useful for adding this attribute to ADAM/ADLDS schema for use with 'userProxy' objects.
# ==================================================================
#
# This file should be imported with the following command:
# ldifde -i -u -f test3.ldf -s server:port -b username domain password -j . -c "cn=Configuration,dc=X" #configurationNamingContext
# LDIFDE.EXE from AD/AM V1.0 or above must be used.
# This LDIF file should be imported into AD or AD/AM. It may not work for other directories.
#
# ==================================================================
# ==================================================================