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 / xmlModule.psm1
Last active May 28, 2017 01:10
A collection of PowerShell functions for creating xml data files.
Function New-XmlDocument
{
[CmdletBinding()]
Param
(
[string]$Root,
[string[]]$Elements
)
Begin
{
@jeffpatton1971
jeffpatton1971 / ManagementPack.psm1
Created April 23, 2015 21:35
A Collection of functions for creating an Operations Manager MP programatically
Function New-ManagementPack
{
[CmdletBinding()]
Param
(
[string]$ID = 'ptech.LegatoNetworker',
[string]$Version = '1.0.0.57',
[string]$Name = 'Legato Networker MP'
)
Begin
@jeffpatton1971
jeffpatton1971 / New-MP.ps1
Created April 23, 2015 21:35
The script I use to create a sample Management Pack
Remove-Variable *
clear
$Mp = New-ManagementPack -ID 'ptech.LegatoNetworker' -Version '1.0.0.57' -Name 'Legato Networker MP'
Add-Reference -ManagementPack $Mp -Reference (New-Reference -ManagementPack $Mp -Alias MSDL -ID Microsoft.SystemCenter.DataWarehouse.Library -Version 6.1.7221.0 -PublicKeyToken 31bf3856ad364e35)
Add-Reference -ManagementPack $Mp -Reference (New-Reference -ManagementPack $Mp -Alias MSIL -ID Microsoft.SystemCenter.InstanceGroup.Library -Version 6.1.7221.0 -PublicKeyToken 31bf3856ad364e35)
Add-Reference -ManagementPack $Mp -Reference (New-Reference -ManagementPack $Mp -Alias SC -ID Microsoft.SystemCenter.Library -Version 6.1.7221.0 -PublicKeyToken 31bf3856ad364e35)
Add-Reference -ManagementPack $Mp -Reference (New-Reference -ManagementPack $Mp -Alias Windows -ID Microsoft.Windows.Library -Version 6.1.7221.0 -PublicKeyToken 31bf3856ad364e35)
Add-Reference -ManagementPack $Mp -Reference (New-Reference -ManagementPack $Mp -Alias System -ID System.Library -Version 6.1.7221.0 -PublicKeyToken
@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 / New-FirewallRule.ps1
Created June 25, 2015 16:42
This function creates a FWRule ComObject that can be added to the firewall.
Function New-FirewallRule
{
<#
.SYNOPSIS
Creates a new HFnetCfg.FWRule ComObject
.DESCRIPTION
This function creates a FWRule ComObject that can be added to the firewall.
Each time you change a property of a rule, Windows Firewall commits the rule and verifies it for correctness.
As a result, when you edit a rule, you must perform the steps in a specific order. For example, if you add an ICMP
@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 / Get-AzureVmStatus.ps1
Created November 17, 2015 16:12
A simple script to get the status of an Azure ARM vm
Param
(
[string]$Name
)
if ($Name)
{
$VM = Get-AzureVM |Where-Object -Property Name -Like $Name |Get-AzureVM -Status |Select-Object -Property Name, ResourceGroupName, Statuses;
$vm.Statuses |ForEach-Object {
New-Object -TypeName psobject -Property @{
Name = $VM.Name;
@jeffpatton1971
jeffpatton1971 / Get-AzureFile.ps1
Last active November 24, 2015 15:12
Get a file from an azure container
Param
(
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$false)]
[string]$StorageAccountName,
[Parameter(Mandatory=$true)]
[string]$ContainerName,
[Parameter(Mandatory=$true)]
[string]$Path
@jeffpatton1971
jeffpatton1971 / Get-AzureAssignedPrivateIpAddress.ps1
Last active November 30, 2015 20:47
This script will return the assigned private ips of each machine in a given subnet. If no subnet is provided it will return the assigned private ips for every machine in all subnets with a configuration.
Param
(
[Parameter(Mandatory=$true)]
[string]$VirtualNetworkName,
[Parameter(Mandatory=$false)]
[string]$SubnetName = '',
[Parameter(Mandatory=$true)]
[string]$Location,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName
@jeffpatton1971
jeffpatton1971 / Enable-AzureNSGDiagnostics.ps1
Last active January 15, 2016 17:17
This is my take of the onboarding code for network security groups. There is no armclient dependency, but you will need the latest Azure Powershell Cmdlets installed.
Param
(
[string]$StorageAccountName,
[string]$StorageAccountResourceGroup
)
try
{
$ErrorActionPreference = "Stop"
$Error.Clear()