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 / Set-Wallpaper.ps1
Created January 2, 2015 18:32
Set the wallpaper of your computer to a specific image. I copied this code to a gist in case the original URL goes away for some reason. http://powershell.com/cs/blogs/tips/archive/2014/01/10/change-desktop-wallpaper.aspx
function Set-Wallpaper
{
param(
[Parameter(Mandatory=$true)]
$Path,
[ValidateSet('Center', 'Stretch')]
$Style = 'Stretch'
)
@jeffpatton1971
jeffpatton1971 / WindowsServer2012R2-Core.ps1
Created February 23, 2015 05:34
Windows Server 2012 R2 Core configuration
Configuration Defaults
{
param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ComputerName
)
Node $ComputerName
{
@jeffpatton1971
jeffpatton1971 / Get-SyncDelay.ps1
Last active August 29, 2015 14:16
This script makes a change to an account and then checks to see how long it takes before that change is replicated on Office365. The script takes advantage of ParameterNames to make it easy to either pass in a credential object or string user/pass variables. I have also added a switch for ExchangeOnline, the original author used the get-mailbox …
<#
.SYNOPSIS
Get the amount of time for an update to Office365
.DESCRIPTION
This script makes a change to an account and then checks to see how long
it takes before that change is replicated on Office365.
.PARAMETER Tenant
This is your tenant name
.PARAMETER Account
This is the test account name
@jeffpatton1971
jeffpatton1971 / Test-W32tmBPA.ps1
Created March 12, 2015 16:22
This script checks the values of specific registry keys based on recommendations from Vmware for virtualized PDC Emulators.
<#
.SYNOPSIS
Check stored values of w32tm against Vmware recommendations
.DESCRIPTION
This script checks the values of specific registry keys based
on recommendations from Vmware for virtualized PDC Emulators.
For more details please see pages 5 and 6 of this Vmware white
paper (http://www.vmware.com/files/pdf/Virtualizing_Windows_Active_Directory.pdf)
.PARAMETER Type
@jeffpatton1971
jeffpatton1971 / MofMofule.psm1
Last active August 29, 2015 14:19
A pair of cmdlets for working with mof files, this is not complete, currently it only handles a few mof instances 'MSFT_RegistryResource','MSFT_RoleResource','MSFT_ServiceResource','OMI_ConfigurationDocument'
Function Get-MofFile
{
[CmdletBinding()]
Param
(
[string]$Path
)
Begin
{
$MofFile = Get-Content $Path
@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 / 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 / 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