Skip to content

Instantly share code, notes, and snippets.

View MattHodge's full-sized avatar

Matthew Hodgkins MattHodge

View GitHub Profile
@MattHodge
MattHodge / ! Windows NXLog | Linux NXLog | LogStash
Last active January 14, 2020 20:30
Configuration files for NXLog on Windows ---> NXLog on Ubuntu --> LogStash
Covers configuration for NXLog installed on Windows, transfering to NXLog installed on Linux to LogStash.
NXLog is used for IIS logs. (http://nxlog-ce.sourceforge.net/)
Snare is used for Windows Event Logs. (http://www.intersectalliance.com/projects/SnareWindows/index.html#Download)
Get-ChildItem Cert:\LocalMachine\Root | Where-Object {$_.Subject -eq 'CN=SubjectName'} | Foreach-Object { [system.IO.file]::WriteAllBytes("C:\SSL\SubjectName.pfx",($_.Export('PFX', 'p@ssw0rd')) ) }
<#
.SYNOPSIS
Send a message when a Storage Spaces Pool, Virtual or Physical Disk is no longer of Health Status.
.DESCRIPTION
Windows 2012 R2 Storage Spaces provides CmdLets to monitor the status of Pool, Virtual or Physical Disk.
This script will send an alert if it notices anything is not Healthy, with the name of the server and the details.
Set this task up inside Task Scheduler
@MattHodge
MattHodge / SetupDevPC.ps1
Last active May 11, 2017 13:30
SetupDevPC
## Run WSUS Offline and Download All Updates
## Use MS USB Image Creater and Put Windows Onto USB
## Follow Steps Here: http://www.sysadminlab.net/mobile/creating-a-fully-patch-install-wim-for-windows-78-without-mdt-but-using-wsus-offline-updater
## Use This Script to Remove Trouble Updates
# Remove Trouble Updates
$updates = Get-ChildItem -Path 'X:\wsusoffline\client\w63-x64\glb'
# Bad Updates From:
# https://support.microsoft.com/en-us/kb/2894518
dsc_resource 'get-dsc-resource-kit' do
resource :Archive
property :ensure, 'Present'
property :path, "#{ENV['USERPROFILE']}/Downloads/DSC Resource Kit 03282014.zip"
property :destination, "#{ENV['PROGRAMW6432']}/WindowsPowerShell/Modules"
end
@MattHodge
MattHodge / nginx.log
Last active August 29, 2015 14:16
Chef Error 500
2014/10/24 14:57:33 [error] 1051#0: *17 connect() failed (111: Connection refused) while connecting to upstream, client: <SERVERIP>, server: chef.<REPLACED>.com, request: "GET /users/hodge HTTP/1.1", upstream: "http://127.0.0.1:8000/users/hodge", host: "chef.<REPLACED>.com:443"
2014/10/24 14:57:33 [error] 1051#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: <SERVERIP>, server: chef.<REPLACED>.com, request: "GET /users/hodge HTTP/1.1", upstream: "http://127.0.0.1:8000/users/hodge", host: "chef.<REPLACED>.com:443"
2015/03/06 17:02:47 [error] 1984#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: <WORKSTATIONIP>, server: chef.<REPLACED>.com, request: "GET /search/node?q=tags%253A*jfk*%2520OR%2520roles%253A*jfk*%2520OR%2520fqdn%253A*jfk*%2520OR%2520addresses%253A*jfk*&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=1000 HTTP/1.1", upstream: "http://127.0.0.1:8000/search/node?q=tags%253A*jfk*%2520OR%2520roles%253A*jfk*%2520OR%2520fqdn%253A*jfk*%
@MattHodge
MattHodge / CreateCertificate.ps1
Last active August 29, 2015 14:22
AUTOMATING WITH JENKINS AND POWERSHELL ON WINDOWS – PART 2
# Enter the bin directory inside the OpenSSL install folder
cd C:\OpenSSL-Win64\bin
# Generate a self-signed SSL certificate. Be sure to update your paths if required.
openssl req -newkey rsa:4096 -nodes -sha256 -keyout C:\temp\jenkins.key -x509 -days 365 -out C:\temp\jenkins.crt -config C:\OpenSSL-Win64\bin\openssl.cfg
# Stop the Jenkins Server
Stop-Service -Name Jenkins
# Edit the Jenkins configuration file
notepad 'C:\Program Files (x86)\Jenkins\jenkins.xml'
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=-1 --httpsPort=443 --httpsCertificate=C:/ssl/jenkins.crt --httpsPrivateKey=C:/ssl/jenkins.key</arguments>