Skip to content

Instantly share code, notes, and snippets.

View gbiellem's full-sized avatar
🏠
Working from home

Greg Bielleman gbiellem

🏠
Working from home
View GitHub Profile
@gbiellem
gbiellem / Delete Private MSMQ Queues
Last active November 4, 2015 00:39
Delete all Private MSMQ Queues - even those with long queue names
# USE COM instead of .Net MessageQueue delete as it handles longer queue names
[Reflection.Assembly]::LoadWithPartialName("System.Messaging")
$q = new-object -ComObject MSMQ.MSMQQueueInfo
$queues = [System.Messaging.MessageQueue]::GetPrivateQueuesByMachine("localhost")
$queues | % {
$q.FormatName = $_.FormatName
$q.Delete()
}
@gbiellem
gbiellem / NoLock.ps1
Last active August 29, 2015 14:20
Disable Lock Screen in Windows8.x
(New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" -Force).SetValue("NoLockScreen", 1)
@gbiellem
gbiellem / QueueReport.ps1
Last active February 18, 2017 23:02
Report NSB messages in error queue and TxDLQ to Slack and also purge any expired ServiceControl Heartbeats that end up in txDLQ
#Requires -RunAsAdministrator
Add-Type -Assembly "System.Messaging"
Function RemoveServiceControlPluginMessagesFromTXDLQ {
$filter = New-Object System.Messaging.MessagePropertyFilter
$filter.Acknowledgment = $true
$filter.LookupId = $true
$filter.Extension = $true
@gbiellem
gbiellem / DiskAndServicesReport.ps1
Last active February 27, 2017 07:10
Disk and Services Report
<#
Send Slack Notification in Disk gets below 20%
Send Slack Notification in any service that match the service name prefixs are not running (skip of service start is not Automatic)
#>
Function SlackDiskReport {
param(
[Parameter(Mandatory, ValueFromPipeLine)]
$disk
)
@gbiellem
gbiellem / RunFirefoxInstaller.ps1
Created February 27, 2017 06:48
Download FireFox installer
pushd $Env:TEMP
iwr "https://download.mozilla.org/?product=firefox-stub&os=win&lang=en-US" -OutFile 'firefox-stub.exe'
& .\firefox-stub.exe
popd
@gbiellem
gbiellem / CreateNSBPerfCounters.ps1
Last active March 12, 2017 07:44
Create NServiceBus Performance counters without the NSB Powershell DLL
#requires -RunAsAdministrator
Function InstallNSBPerfCounters {
$category = @{Name="NServiceBus"; Description="NServiceBus statistics"}
$counters = New-Object System.Diagnostics.CounterCreationDataCollection
$counters.AddRange(@(
New-Object System.Diagnostics.CounterCreationData "Critical Time", "Age of the oldest message in the queue.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "SLA violation countdown", "Seconds until the SLA for this endpoint is breached.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "# of msgs successfully processed / sec", "The current number of messages processed successfully by the transport per second.", RateOfCountsPerSecond32
@gbiellem
gbiellem / local.ini
Created August 28, 2017 12:42
Sample Couch 2.1 local Ini config that works with proxy auth
; CouchDB Configuration Settings
; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.
[couchdb]
;max_document_size = 4294967296 ; bytes
;os_process_timeout = 5000
uuid = a4380b3563aa5c628fa98c5ccc4e160b
@gbiellem
gbiellem / SetUnblockPolicy.ps1
Created September 2, 2017 03:41
Turn off Downloads being "Blocked"
$reg = @{
Path = 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments'
Name = 'SaveZoneInformation'
PropertyType = 'DWORD'
Value = 1
}
if (-not (Test-Path -Path $reg.Path)) {
New-Item $reg.Path
}
@gbiellem
gbiellem / cors.ps1
Created October 12, 2017 00:38
Couch CORS test
$requestheaders = @{
"Origin" = "http://localhost"
}
$response = Invoke-WebRequest -Uri http://couch/inbox/_all_docs -UseDefaultCredentials -Headers $requestheaders
$response | Select -ExpandProperty Headers
@gbiellem
gbiellem / CouchDevSetup.ps1
Last active April 12, 2018 07:21
Setup 2 instances of CouchDB locally (dev and test)
#Requires -RunAsAdministrator
#Requires -Version 5.1
if (-not(Get-Module IniManager -ErrorAction SilentlyContinue)) {
Install-Module -Name IniManager -Force
}
Import-Module -Name IniManager
$webBinary = 'https://dl.bintray.com/apache/couchdb/win/2.1.1/couchdb-2.1.1.msi'
$msi = "~\Downloads\couchdb-2.1.1.msi"