Skip to content

Instantly share code, notes, and snippets.

View pcgeek86's full-sized avatar
🍺
🥓

Trevor Sullivan pcgeek86

🍺
🥓
View GitHub Profile
@pcgeek86
pcgeek86 / Enter-AzurePSSession.ps1
Created January 8, 2015 19:33
A helper function to connect to Microsoft Azure virtual machines using PowerShell Remoting. Visit http://trevorsullivan.net.
function Enter-AzurePSSession {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $ServiceName,
[Parameter(Mandatory = $true)]
[string] $VMName
)
$SessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck;
$WinRMUri = Get-AzureWinRMUri -ServiceName $ServiceName -Name $VMName;
@pcgeek86
pcgeek86 / Stop-AzureVMParallel.ps1
Created February 27, 2015 19:28
Stop Microsoft Azure Virtual Machines in parallel
$VMList = Get-AzureVM;
foreach ($VM in $VMList) {
Start-Job -ScriptBlock {
Write-Output -Message ('Stopping VM {0} {1}' -f $args[0].ServiceName, $args[0].Name);
Stop-AzureVM -ServiceName $args[0].ServiceName -Name $args[0].Name -Force;
} -ArgumentList $VM;
}
@pcgeek86
pcgeek86 / azrdp.ps1
Last active August 29, 2015 14:17
A simple PowerShell function to simplify the process of establishing a RDP connection to a Microsoft Azure Virtual Machine.
function azrdp {
<#
.Author
Trevor Sullivan <pcgeek86@gmail.com>
.Description
Invoke a RDP session to an Azure Virtual Machine, without having to type the
Cloud Service name or Virtual Machine name.
.Outputs
@pcgeek86
pcgeek86 / Get-DscRequiredProperties.ps1
Created March 17, 2015 03:54
Find required properties for a PowerShell DSC Resource
### Find the required properties for a particular DSC resource
(Get-DscResource | Out-GridView -PassThru).Properties;
@pcgeek86
pcgeek86 / Get-AzureStorageContainersAsync.ps1
Created April 3, 2015 02:32
This PowerShell script uses PowerShell Background Jobs to enumerate all blob containers in each of your Azure Storage Accounts.
<#
.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 / PowerShell v5 Class Serialization Pattern.ps1
Created July 9, 2015 16:34
This Gist provides a suggested pattern for serializing / deserializing PowerShell v5 class instances
class Person {
[ValidateNotNullOrEmpty()]
[string] $FirstName;
[ValidateNotNullOrEmpty()]
[string] $LastName;
[string] $Address;
Person([string] $First, [string] $Last) {
$this.FirstName = $First;
@pcgeek86
pcgeek86 / gist:4a1b74f37eaecac58cf777820f0177c9
Created August 1, 2016 15:07
Trevor's PowerShell Prompt
function Prompt {
<#
.Notes
Author: Trevor Sullivan
Website: https://trevorsullivan.net
Twitter: https://twitter.com/pcgeek86
#>
$ATAT = @'
____==========_______
_--____ | | "" " "| \
@pcgeek86
pcgeek86 / ClusterHQ-FlockerHub-Demo.sh
Last active November 28, 2016 16:41
This Bash script is a simple end-to-end example of ClusterHQ Fli + FlockerHub.
#!/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
@pcgeek86
pcgeek86 / existing code to git repo
Created March 23, 2017 15:34 — forked from zenideas/existing code to git repo
Adding existing source to remote 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 / Dockerfile
Created October 27, 2017 18:37
Install Python 3.6 and Boto3 package on Windows Server container
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/