Skip to content

Instantly share code, notes, and snippets.

Avatar
🍺
🥓

Trevor Sullivan pcgeek86

🍺
🥓
View GitHub Profile
View PowerShell-AD-SCCM-Workstation-Cleanup-Script-Version-3.0.ps1
###############################################################################
# Author: Trevor Sullivan
#
# Date: October 28, 2009
#
# Lessons learned:
#
# 1. ADSI property names are lower case using DirectorySearcher or DirectoryEntry
# 2. Must explicitly cast 64-bit integers from AD
# 3. The Excel API is terrible (already knew that) #
@pcgeek86
pcgeek86 / Dockerfile
Created Oct 27, 2017
Install Python 3.6 and Boto3 package on Windows Server container
View Dockerfile
FROM microsoft/windowsservercore
MAINTAINER Trevor Sullivan <tsulli@amazon.com>
SHELL ["powershell", "-Command"]
ENV PYTHON_DOWNLOAD https://www.python.org/ftp/python/3.6.3/python-3.6.3-amd64.exe
ENV PYTHON_FILE python-3.6.3-amd64.exe
COPY Install-Boto3.py c:/Amazon/
@pcgeek86
pcgeek86 / existing code to git repo
Created Mar 23, 2017 — forked from zenideas/existing code to git repo
Adding existing source to remote git repo
View existing code to git repo
If you've got local source code you want to add to a new remote new git repository without 'cloning' the remote first, do the following (I often do this - you create your remote empty repository in bitbucket/github, then push up your source)
1. Create the remote repository, and get the URL such as git://github.com/youruser/somename.git
2. If your local GIT repo is already set up, skips steps 2 and 3
3. Locally, at the root directory of your source, git init
4. Locally, add and commit what you want in your initial repo (for everything,
git add .
@pcgeek86
pcgeek86 / ClusterHQ-FlockerHub-Demo.sh
Last active Nov 28, 2016
This Bash script is a simple end-to-end example of ClusterHQ Fli + FlockerHub.
View ClusterHQ-FlockerHub-Demo.sh
#!/bin/bash
### Visit http://ui.dev.voluminous.io/user-tokens to get a user token
### NOTE: This file should contain a function definition called 'fli'
source ~/.bash-fli
set -e
shopt -s expand_aliases
View gist:4a1b74f37eaecac58cf777820f0177c9
function Prompt {
<#
.Notes
Author: Trevor Sullivan
Website: https://trevorsullivan.net
Twitter: https://twitter.com/pcgeek86
#>
$ATAT = @'
____==========_______
_--____ | | "" " "| \
@pcgeek86
pcgeek86 / PowerShell v5 Class Serialization Pattern.ps1
Created Jul 9, 2015
This Gist provides a suggested pattern for serializing / deserializing PowerShell v5 class instances
View PowerShell v5 Class Serialization Pattern.ps1
class Person {
[ValidateNotNullOrEmpty()]
[string] $FirstName;
[ValidateNotNullOrEmpty()]
[string] $LastName;
[string] $Address;
Person([string] $First, [string] $Last) {
$this.FirstName = $First;
@pcgeek86
pcgeek86 / Wait-AzureVMDscConfiguration.ps1
Created May 22, 2015
Waits for a DSC configuration to complete on an Azure Virtual Machine.
View Wait-AzureVMDscConfiguration.ps1
function Wait-AzureVMDscConfiguration {
<#
.Synopsis
Waits for a DSC configuration to complete on an Azure Virtual Machine.
.Parameter ServiceName
The name of the Azure Cloud Service containing the Virtual Machine.
.Parameter Name
The name of the Azure Virtual Machine inside the Cloud Service container.
@pcgeek86
pcgeek86 / Get-AzureStorageContainersAsync.ps1
Created Apr 3, 2015
This PowerShell script uses PowerShell Background Jobs to enumerate all blob containers in each of your Azure Storage Accounts.
View Get-AzureStorageContainersAsync.ps1
<#
.Author
Trevor Sullivan <pcgeek86@gmail.com>
.Links
http://trevorsullivan.net
http://twitter.com/pcgeek86
.Description
This PowerShell script uses the Microsoft Azure PowerShell module along with PowerShell
@pcgeek86
pcgeek86 / Azure Disks by Storage Account.ps1
Last active Dec 20, 2021
Azure Disk Objects :: Add a StorageAccount property
View Azure Disks by Storage Account.ps1
<#
Author: Trevor Sullivan
Date: 2015-03-29
Description: Microsoft Azure Disk objects offer the full URL to the cloud-based VHD
however, the Storage Account name is not exposed independently. We can
use PowerShell's Add-Member command to parse the URL and offer up the
Storage Account as its own property on each Disk object.
#>
Select-AzureSubscription -SubscriptionName 'Visual Studio Ultimate with MSDN';
@pcgeek86
pcgeek86 / Get-DscRequiredProperties.ps1
Created Mar 17, 2015
Find required properties for a PowerShell DSC Resource
View Get-DscRequiredProperties.ps1
### Find the required properties for a particular DSC resource
(Get-DscResource | Out-GridView -PassThru).Properties;