Skip to content

Instantly share code, notes, and snippets.


Devyn Spencer devynspencer

Block or report user

Report or block devynspencer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Get-Inventory.ps1
workflow {
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByValue)]
[pscredential] $Credential = "$env:USERDOMAIN\$env:USERNAME",
[switch] $All,
[switch] $Configuration,
[switch] $Users # sessions, user profiles, accounts, groups
View Red_FunctionTemplate.sqf
params ["_required1", "_required2", ["default1", "value"], ["default2", 5], ["default3", west]]
private ["_var1", "_var2", "_var3", "_var4"]
// header
_Zen_stack_Trace = ["Zen_ArrayAppend", _this] call Zen_StackAdd;
if !([_this, [["ARRAY"], ["VOID"], ["VOID"], ["VOID"], ["VOID"], ["VOID"], ["VOID"]], [], 2] call Zen_CheckArguments) exitWith {
call Zen_StackRemove;
// execute something here
View Repair-HomeDirectories.ps1
function Repair-HomeDirectoryAcl {
# TODO: cast this as a file-object / review PowerShell idioms for working with directories
[Parameter(Mandatory, ValueFromPipeline) # TODO: , ValueFromPipelineByProperty)]
[string] $Path,
[switch] $Recurse
process {
devynspencer / Functions.ps1
Last active Nov 17, 2016
Useful PowerShell functions, for eventual aggregation into a utilities module or similar.
View Functions.ps1
function ConvertTo-BooleanString ($value) {
return [System.Convert]::ToBoolean($value).ToString()
View CmdletTemplate.ps1
Function New-Something {
[Parameter(Mandatory=$True, ValueFromPipeline=$True)]
[string[]] $ComputerName
begin {
View deploy-wsus.ps1
WSUS Installer v1
by Trevor Jones
This script installs and configures WSUS on a Windows 2012 server.
You have the option to use WID, Local SQL Express or an existing SQL Server.
If you choose Local SQL Express it will be downloaded and installed for you with a default configuration.
Report Viewer 2008 is also optionally installed, it is required to view WSUS reports.
devynspencer / Get-LastUpdated.ps1
Created Sep 1, 2016
Get the installation time for the last successful update to a server.
View Get-LastUpdated.ps1
foreach ($Server in $servers) {
$key = “SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install”
$keytype = [Microsoft.Win32.RegistryHive]::LocalMachine
$RemoteBase = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($keytype,$Server)
$regKey = $RemoteBase.OpenSubKey($key)
$KeyValue = $regkey.GetValue(”LastSuccessTime”)
$System = (Get-Date -Format "yyyy-MM-dd hh:mm:ss")
if ($KeyValue -lt $System) {
Write-Host " "
devynspencer / script_deployment.bat
Created Aug 26, 2016
Example batch file to run a powershell script without having to fuck with the system execution policy
View script_deployment.bat
@echo off
Powershell -noprofile -executionpolicy bypass -file "C:\scripts\script.ps1"
devynspencer /
Last active Jun 15, 2016
Finding blocked packages repositories from iptables logs, then creating a manageable list for to distribute to other hosts.
[dspencer@poseidon ~]$ cat /tmp/iptables_yum.txt | awk '{ print $10}' |\
  sed 's/DST=//' | xargs -n1 host | awk '{ print $5 }' | grep -v NXDOMAIN | sort -u
devynspencer / ansible-github.yml
Last active Aug 21, 2019
Example playbook for cloning a private git repository with Ansible.
View ansible-github.yml
hosts: all
- name: add github ssh key
copy: >
You can’t perform that action at this time.