Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Patton jeffpatton1971

View GitHub Profile
@jeffpatton1971
jeffpatton1971 / Get-WinEventTail.ps1
Last active Oct 21, 2020
This function will allow you to tail Windows Event Logs. You specify a Logname for either the original logs, Application, System and Security or the new format for the newer logs Microsoft-Windows-PowerShell/Operational
View Get-WinEventTail.ps1
Function Get-WinEventTail
{
<#
.SYNOPSIS
A tail cmdlet for Eventlogs
.DESCRIPTION
This function will allow you to tail Windows Event Logs. You specify
a Logname for either the original logs, Application, System and Security or
the new format for the newer logs Microsoft-Windows-PowerShell/Operational
.PARAMETER LogName
View array.json
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"type": "object",
"title": "The root schema",
"description": "The root schema comprises the entire JSON document.",
"default": {},
"examples": [
{
"products": [
@jeffpatton1971
jeffpatton1971 / New-HelpFile.ps1
Last active Sep 3, 2020
This script will build output to the screen a properly formatted XML help file. I based this on one of the installed helpfiles in System32.
View New-HelpFile.ps1
<#
.SYNOPSIS
This script will generate a proper XML helpfile
.DESCRIPTION
This script will build output to the screen a properly formatted
XML help file. I based this on one of the installed helpfiles
in System32.
.PARAMETER Commands
You can pass in the output from Get-Command cmdletname or you
can pass in Get-Command -Module moduleName
View pipeline.yaml
trigger: none
pool:
vmImage: 'windows-2019'
resources:
repositories:
- repository: tools
type: github
name: Azure-Devops-PowerShell-Module/tools
@jeffpatton1971
jeffpatton1971 / Export-FederationConfigurationV2.ps1
Last active Jul 22, 2020
This is the Export-FederationConfiguration.ps1 and Import-FederationConfiguration.ps1 files that are found in the C:\Windows\ADFS folder. I have made a few minor changes in each see this thread for details. https://social.technet.microsoft.com/Forums/en-US/02a5594b-00df-4731-ae98-992956bafc19/adfs-unable-to-export-the-adfs-configuration?forum=wi…
View Export-FederationConfigurationV2.ps1
<#############################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
############################################################>
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact="Medium", DefaultParameterSetName="Default")]
Param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelinebyPropertyName=$true)]
[string] $Path,
[Parameter(Mandatory=$false)]
@jeffpatton1971
jeffpatton1971 / Get-BingImage.ps1
Last active Jun 22, 2020
This script can be used to download Bing background images for use as your wallpaper or to save. It uses a specially crafted URL that I found while searching for a way to download them. It appears that the URL will let you go back 18 days, or the last 8 images. When you set Index to 18 and NumberOfImages to 8 a total of 19 images will be downloa…
View Get-BingImage.ps1
<#
.SYNOPSIS
Use this script to download the Bing background image.
.DESCRIPTION
This script can be used to download Bing background images for use
as your wallpaper or to save. It uses a specially crafted URL that I
found while searching for a way to download them.
It appears that the URL will let you go back 18 days, or the last 8
images. When you set Index to 18 and NumberOfImages to 8 a total of
@jeffpatton1971
jeffpatton1971 / New-RulesFromNetstat.ps1
Created Jan 15, 2014
A script to create firewall rules based on netstat output
View New-RulesFromNetstat.ps1
<#
Create FW rules for TCP and UDP Listening Ports
netstat -an -p tcp |Select-String "Listening"
netstat -an -p udp |Select-String "Listening"
for each entry in netstat create firewall rule
name = -p tcp|udp port port #
description = automatic allow rule generated by powershell on get-date
View data.json
{
"subject": "linescore_mlb_2019_08_09_anamlb_bosmlb_1",
"copyright": "NOTICE: This file is no longer actively supported. Please use the MLB Stats API (http://statsapi.mlb.com/docs/) as an alternative. Copyright 2019 MLB Advanced Media, L.P. Use of any content on this page acknowledges agreement to the terms posted here http://gdx.mlb.com/components/copyright.txt",
"data": {
"game": {
"linescore": [{
"away_inning_runs": "3",
"home_inning_runs": "1",
"inning": "1"
}, {
@jeffpatton1971
jeffpatton1971 / WebServer.ps1
Last active Apr 16, 2019
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…
View WebServer.ps1
Configuration BasicWebServer
{
param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$ComputerName,
[string]$Source = $null,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
@jeffpatton1971
jeffpatton1971 / encoding-helpers.ps1
Created Mar 20, 2018 — forked from jpoehls/encoding-helpers.ps1
Convert-FileEncoding and Get-FileEncoding
View encoding-helpers.ps1
<#
.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
You can’t perform that action at this time.