Skip to content

Instantly share code, notes, and snippets.

View jeffpatton1971's full-sized avatar
😄
Writing code 25 hours a day, 8 days a week!

Jeff Patton jeffpatton1971

😄
Writing code 25 hours a day, 8 days a week!
View GitHub Profile
@jeffpatton1971
jeffpatton1971 / Stop-AzureVM.ps1
Last active April 21, 2017 19:35
A workflow to poweroff/on vm's in a resourcegroup
workflow Stop-AzureVM
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[string[]]$VMList,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
@jeffpatton1971
jeffpatton1971 / README.md
Last active April 1, 2017 16:58
This script is designed to either start or stop a group of VM's in a Resource Group in Azure.

UpdatePowerState

This script and workflow is designed to either start or stop a group of VM's in a Resource Group in Azure. The script/workflow has 3 parameters:

  • AzureConnectionAssetName
  • ResourceGroupName
  • PowerState

AzureConnectionAssetName

This defaults to AzureRunAsConnection which is the default connection name Azure creates when running through the Azure Automation Account wizard.

@jeffpatton1971
jeffpatton1971 / Get-CloudBlob.ps1
Created March 31, 2017 17:07
A simple script to return the blobs in a container, you will need to be logged into an Azure subscription with Login-AzureRMAccount before this will return anything
param
(
[Parameter(Mandatory=$true,Position=0)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true,Position=1)]
[string]$StorageAccountName,
[Parameter(Mandatory=$true,Position=2)]
[string]$Container
)
@jeffpatton1971
jeffpatton1971 / Enable-WinRM.ps1
Created February 4, 2017 15:12
This script will enable WinRM
param
(
[string]$Hostname = $env:COMPUTERNAME
)
try
{
$ErrorActionPreference = 'Stop';
$CertificateThumbprint = (New-SelfSignedCertificate -DnsName $Hostname -CertStoreLocation Cert:\LocalMachine\My).Thumbprint;
New-WSManInstance -ResourceURI 'winrm/config/listener' -SelectorSet @{Address='*';Transport='https'} -ValueSet @{Hostname=$Hostname;CertificateThumbprint=$CertificateThumbprint}
}
@jeffpatton1971
jeffpatton1971 / StorageAccountCopy.ps1
Last active January 31, 2017 15:59
A script to copy Blobs between Azure Storage Accounts
param
(
[string]$SourceStorageAccountName,
[string]$SourceStorageAccountResourcegroupName,
[string]$SourceStorageAccountContainerName,
[string]$DestStorageAccountKey,
[string]$DestStorageAccountContainerName
)
try
@jeffpatton1971
jeffpatton1971 / LinuxConfiguation.ps1
Created December 31, 2016 15:20
Simple configuration, all vm's with role == server should get user01 and all vm's with role == webserver should get apache installed.
Configuration LinuxConf
{
Import-DscResource -ModuleName nx
Node $AllNodes.Where{$_.Role -like "*server"}.NodeName
{
nxUser NewAccount
{
UserName = 'user01'
Ensure = 'Present'
@jeffpatton1971
jeffpatton1971 / DisableSSLv3.ps1
Last active November 2, 2016 17:25
Disable SSL V3 Stuff and set ciphersuites
$Protocols = "SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols"
$Ciphers = "SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers"
$Hashes = "SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes"
$KeyExchangeAlgorithms = "SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms"
$CipherOrder = "SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002"
Import-Module C:\projects\mod-posh\powershell\production\includes\RegistryLibrary.psm1
#
# Disable old SSL
#
@jeffpatton1971
jeffpatton1971 / GPMgmt.psm1
Last active November 2, 2016 17:25
A rough draft of a group policy module and a script to show how to use it for a very specifc case
Function Get-Gpo
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true,Position=0,ParameterSetName="DisplayName")]
[string]$DisplayName,
[Parameter(Mandatory=$true,Position=0,ParameterSetName="Id")]
[string]$Id,
[Parameter(Mandatory=$true,Position=0,ParameterSetName="All")]
@jeffpatton1971
jeffpatton1971 / New-DscFile.ps1
Last active October 12, 2016 14:43
Detect installed and not installed features to output a DSC file
<#
.SYNOPSIS
Detect installed and not installed features to output a DSC file
.DESCRIPTION
This script will return a list of features that are installed and not installed
for the server you run it on. This can be viewed as a basic starting point in
getting DSC up and running for a given server. Once you have this information
you can use it to simply make sure this server always has these settings, or
add to it with more DSC Resources.
.EXAMPLE
Param
(
[Parameter(Mandatory=$true)]
[string]$VirtualNetworkName,
[Parameter(Mandatory=$false)]
[string]$SubnetName = '',
[Parameter(Mandatory=$true)]
[string]$Location,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName