Skip to content

Instantly share code, notes, and snippets.

Jeff Patton jeffpatton1971

View GitHub Profile
@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
View odbc-excel.ps1
param
(
$strFileName = "C:scriptsfile.xlsx",
$strSheetName = 'Out'
)
if (!(($strSheetName.Substring($strSheetName.Length-1,1)) -eq '$'))
{
$strSheetName = "$($strSheetName)`$"
}
$strProvider = "Provider=Microsoft.ACE.OLEDB.12.0"
View rollback.ps1
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 Aug 17, 2017
A script that will pull the logs from Windows that have records, between the dates specified.
View Get-RecentEvent.ps1
param
(
$StartDate = (Get-Date),
$EndDate = (Get-Date)
)
try
{
$ErrorActionPreference = 'Stop';
$Error.Clear();
@jeffpatton1971
jeffpatton1971 / mpprovider.ps1
Created Aug 17, 2017
powershell you could run on a server to make sure Realtime protection is enabled
View mpprovider.ps1
import-module 'C:\Program Files\Microsoft Security Client\MpProvider\MpProvider.psd1'
get-mprotcomputerstatus
@jeffpatton1971
jeffpatton1971 / New-Password.ps1
Last active Aug 16, 2017
Simple function that leverages the Crypto API to generate truly random passwords.
View New-Password.ps1
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 Aug 12, 2017
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.
View New-WordTable.ps1
Function New-WordTable {
[cmdletbinding(
DefaultParameterSetName='Table'
)]
Param (
[parameter()]
[object]$WordObject,
[parameter()]
[object]$Object,
[parameter()]
@jeffpatton1971
jeffpatton1971 / Stop-AzureVM.ps1
Last active Apr 21, 2017
A workflow to poweroff/on vm's in a resourcegroup
View Stop-AzureVM.ps1
workflow Stop-AzureVM
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[string[]]$VMList,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
@jeffpatton1971
jeffpatton1971 / Get-CloudBlob.ps1
Created Mar 31, 2017
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
View Get-CloudBlob.ps1
param
(
[Parameter(Mandatory=$true,Position=0)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true,Position=1)]
[string]$StorageAccountName,
[Parameter(Mandatory=$true,Position=2)]
[string]$Container
)
@jeffpatton1971
jeffpatton1971 / README.md
Last active Apr 1, 2017
This script is designed to either start or stop a group of VM's in a Resource Group in Azure.
View README.md

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.

You can’t perform that action at this time.