Skip to content

Instantly share code, notes, and snippets.

View RafPe's full-sized avatar
🎯
Focusing

Rafal Pieniazek RafPe

🎯
Focusing
View GitHub Profile
$folder4Logs = "X:\AdvancedIISLogs"
$LogRotateFreq = "Hourly" # Change to your desired frequency
#Check if we have folder for our logs - if not create one
if(!(Test-Path $folder4Logs))
{
# Create such a directory
New-Item -ItemType Directory -Path X:\ -Name AdvancedIISLogs
}
# Function which allows for quick set/get of app pool property - make sure you have the newest one :)
# available @ https://gist.github.com/RafPe/77d2ff28f7a0014bf0f1
function Invoke-AppPoolSetting
{
<#
.SYNOPSIS
Gets or sets application pool setting
.PARAMETER appPoolName
function Export-FunctionRemote
{
<#
.SYNOPSIS
Exports function to String ScriptBlock
.PARAMETER functionName
this is object type data coming via pipeline
.DESCRIPTION
function Get-RemoteRequiredFunctions
{
<#
.SYNOPSIS
Gets required functions
.PARAMETER functionName
this is object type data coming via pipeline
@RafPe
RafPe / CustomizeMaintanancePage.ps1
Created August 15, 2015 19:18
Customizes variables in format {COUNTRY_locale_Property} i.e. {ES_es-ES_DayOfWeek}
# We load our maintanance page
$maintanancePage = Get-Content -Raw "C:\Users\rafpe\Desktop\index.html"
# we define our countries
$pageCountries= @( @{country="NL";locale=@("nl-NL","en-US")}, `
@{country="BE";locale=@("nl-BE","fr-BE","de-DE","en-US")},`
@{country="FR";locale=@("fr-FR")},`
@{country="DE";locale=@("de-DE")},`
@{country="UK";locale=@("en-GB")},`
@{country="US";locale=@("en-US")}
$tfsurl = 'https://tfs.someservername:8088/tfs/SomeAwesomeCollection'
$username = 'administrator'
$domain = 'MyCompany'
$password = 'Password1'
# Create URI
$tfs_uri = [System.Uri]::new( $tfsurl )
@RafPe
RafPe / New-nLogLogger.ps1
Last active July 17, 2021 09:34
Nlog logging with PowerShell
$dllBytes = [System.IO.File]::ReadAllBytes( "C:\NLog.dll")
[System.Reflection.Assembly]::Load($dllBytes)
# Create object that we will use to send customized info
# This is to be used if you use ${event-context:item=MyValue} in your config !
$cos = new-object NLog.LogEventInfo
$cos.Level = [NLog.LogLevel]::Info
$cos.Message = 'executing something really cool'
# Load XML configuration and use it
@RafPe
RafPe / CapitalizeFirstCharacter.ps1
Last active September 1, 2015 11:53
If you need to change first character in proper way
$variableToChange = "all lowercase"
$result = -join ($variableToChange.Substring(0,1).ToUpper() ,$variableToChange.Substring(1,$variableToChange.Length-1 ) )
@RafPe
RafPe / logstash_config_simple.conf
Last active September 28, 2015 18:33
This is simple logstash config file just to get you quickly up and running especially when testing with Docker
input {
tcp {
port => 25826
type => syslog
}
udp {
port => 25826
type => syslog
}
}
@RafPe
RafPe / docker-compose_elk_with_redis.yml
Last active April 1, 2016 05:50
This is ELK stack docker-compose file allowing you to quickly get the system up and running. For this to work you need to modify the paths for config and data locations
elasticsearch-central:
image: elasticsearch:2
container_name: elasticsearch-central
volumes:
- _replaceme_/elasticsearch/data:/usr/share/elasticsearch/data
- _replaceme_/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
environment:
- ES_CLUSTERNAME=_clustername_
command: elasticsearch
ports: