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 / WebServer.ps1
Last active April 16, 2019 17:47
This DSC Configuration shows off several features available via DSC. It installs the Web-Server feature, and several additional web features that each depend on Web-Server being installed. It uses the Package reference to install the WebDeploy MSI, based on that path passed in the param, which also depends on Web-Server. It uses a Script referen…
Configuration BasicWebServer
{
param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ComputerName,
[string]$Source = $null,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
@jeffpatton1971
jeffpatton1971 / encoding-helpers.ps1
Created March 20, 2018 15:51 — forked from jpoehls/encoding-helpers.ps1
Convert-FileEncoding and Get-FileEncoding
<#
.SYNOPSIS
Converts files to the given encoding.
Matches the include pattern recursively under the given path.
.EXAMPLE
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8
#>
function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') {
$count = 0
@jeffpatton1971
jeffpatton1971 / New-SCOMChannelO365.ps1
Last active November 27, 2017 13:14
This script is used as a command channel to generate alert emails from the data stored in the Alert Context tab of the Office 365 Message Center and Incident alerts. There is no simple way to retrieve this data as that tab is more or less free form, so the data is pulled from SCOM, filtered for New resolution state and then send to the list of e…
<#
.SYNOPSIS
A custom command channel to generate emails from Office 365 Alert Context data
.DESCRIPTION
This script is used as a command channel to generate alert emails from the data
stored in the Alert Context tab of the Office 365 Message Center alerts. There
is no simple way to retrieve this data as that tab is more or less free form,
so the data is pulled from SCOM, filtered for New resolution state and then
send to the lsit of email addresses.
.PARAMETER SmtpHost
param
(
$strFileName = "C:scriptsfile.xlsx",
$strSheetName = 'Out'
)
if (!(($strSheetName.Substring($strSheetName.Length-1,1)) -eq '$'))
{
$strSheetName = "$($strSheetName)`$"
}
$strProvider = "Provider=Microsoft.ACE.OLEDB.12.0"
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client";
Remove-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\
@jeffpatton1971
jeffpatton1971 / Get-RecentEvent.ps1
Created August 17, 2017 20:51
A script that will pull the logs from Windows that have records, between the dates specified.
param
(
$StartDate = (Get-Date),
$EndDate = (Get-Date)
)
try
{
$ErrorActionPreference = 'Stop';
$Error.Clear();
@jeffpatton1971
jeffpatton1971 / mpprovider.ps1
Created August 17, 2017 18:59
powershell you could run on a server to make sure Realtime protection is enabled
import-module 'C:\Program Files\Microsoft Security Client\MpProvider\MpProvider.psd1'
get-mprotcomputerstatus
@jeffpatton1971
jeffpatton1971 / New-Password.ps1
Last active August 16, 2017 13:52
Simple function that leverages the Crypto API to generate truly random passwords.
Function New-Password
{
<#
.SYNOPSIS
Create a new password
.DESCRIPTION
This function creates a password using the cryptographic Random Number Generator see the
MSDN link for more details.
.PARAMETER Length
An integer that defines how long the password should be
@jeffpatton1971
jeffpatton1971 / New-WordTable.ps1
Last active August 12, 2017 19:46
Updatedp version of the New-WordTable function from Boe Prox (https://learn-powershell.net/2015/01/24/creating-a-table-in-word-using-powershell/) It had a few problems as he forgot to use the selection object in creating ranges and tables.
Function New-WordTable {
[cmdletbinding(
DefaultParameterSetName='Table'
)]
Param (
[parameter()]
[object]$WordObject,
[parameter()]
[object]$Object,
[parameter()]
@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
{