Skip to content

Instantly share code, notes, and snippets.

@smaglio81
smaglio81 / WebAmin.New-WebProcDump.ps1
Created August 18, 2018 22:01
Takes a procdump of the w3wp process associated with a given url (either locally or remote). Transfer the process dump to a communal shared location for retrieval.
if($global:WebAdmin -eq $null) {
$global:WebAdmin = @{}
}
# http://stackoverflow.com/questions/1183183/path-of-currently-executing-powershell-script
$root = Split-Path $MyInvocation.MyCommand.Path -Parent;
$global:WebAdmin.ProcDumpLocalPath = "$root\Resources\procdump.exe"
<#
############## https://notsomany.wordpress.com/2017/12/08/iis-logs-to-sql-database-using-powershell-and-log-parser/
$dbserver = "$env:COMPUTERNAME,1433"
$database = "iislogs"
$proxyserver = "<your-web-server>"
$ErrorActionPreference = "Stop"
$Error.Clear()
@smaglio81
smaglio81 / IisLogs.sql
Created August 19, 2018 00:51
Script to create the IisLogs table with indexes.
SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
@smaglio81
smaglio81 / default-no-endpoint-handler.xml
Created August 19, 2018 17:11
Apigee Catch-All RaiseFault Handler
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="DevPortal-Response">
<DisplayName>DevPortal Response</DisplayName>
<Properties/>
<FaultResponse>
<Set>
<Headers>
<Header name="Location">https://devportal.yoursite.com</Header>
</Headers>
<Payload contentType="application/json">
@smaglio81
smaglio81 / AWS_ALB_New_Connections.sql
Last active August 27, 2018 02:33
Determine # of New Connections through ALB
use IisLogs
go
/******************************************************************
AWS ALB DIMENSION: New Connections
******************************************************************/
declare @dateStart varchar(10) = '2018-07-18',
@smaglio81
smaglio81 / AWS_ALB_Bandwidth.sql
Last active September 2, 2018 19:01
Determine the Bandwidth through ALB
use IisLogs
go
/******************************************************************
AWS ALB DIMENSION: Mbps per Hour
******************************************************************/
declare @dateStart varchar(10) = '2018-07-18',
@smaglio81
smaglio81 / AWS_ALB_Active_Connections.sql
Last active September 2, 2018 22:03
Determine # of Active Connections through ALB
use IisLogs
go
/******************************************************************
AWS ALB DIMENSION: Active Connections per Minute by Hour
******************************************************************/
declare @dateStart varchar(10) = '2018-07-18',
@smaglio81
smaglio81 / dbo.ProxyWebApps.sql
Last active September 3, 2018 01:50
Create ProxyWebApps and ProxyWebAppCounts tables
USE [IisLogs]
GO
/****** Object: Table [dbo].[ProxyWebApps] Script Date: 9/2/2018 6:48:43 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
@smaglio81
smaglio81 / Populate-ProxyWebAppCounts.sql
Created September 3, 2018 01:52
Populate ProxyWebAppCounts
insert into [dbo].[ProxyWebAppCounts]
select SiteName, count(*) [WebAppCount]
from [dbo].[ProxyWebApps]
USE [IisLogs]
GO
/****** Object: Table [dbo].[ProxyWebAppCounts] Script Date: 9/2/2018 6:54:29 PM ******/
CREATE TABLE [dbo].[ProxyWebAppCounts](
[SiteName] [varchar](255) NOT NULL,
[WebAppCount] [int] NOT NULL,
CONSTRAINT [PK_ProxyWebAppCounts] PRIMARY KEY CLUSTERED
(
[SiteName] ASC