Skip to content

Instantly share code, notes, and snippets.

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

John Bevan JohnLBevan

🏠
Working from home
View GitHub Profile
@BrandtLassen
BrandtLassen / FixPerformanceCounters.sp1
Created May 23, 2014 11:05
Recreate BizTalk performance counters after in-place upgrade of BizTalk 2010 to BizTalk 2013
param([Switch]$Fix, [Switch]$Verbose)
<#
During our testing of in-place upgrades of BizTalk 2010 to BizTalk 2013 we've seen performance counters disappear (especially the BizTalk:Message Agent and BizTalk:Messaging counters).
Inspired by:
• http://blogs.msdn.com/b/biztalkperformance/archive/2007/09/30/how-to-manually-recreate-missing-biztalk-performance-counters.aspx
• http://blogs.msdn.com/b/biztalkcpr/archive/2010/06/23/have-you-manually-recreated-the-biztalk-performance-counter-using-the-following-link-but-some-of-the-counters-were-still-missing.aspx
@HarmJ0y
HarmJ0y / gist:fd98c4f16575ba28c091
Last active April 27, 2023 13:56
Powershell ADSI tricks
# Add a domain user to a remote server local group, if your current user has admin over the remote machine
powershell -c ([ADSI]'WinNT://SERVER/Administrators,group').add('WinNT://DOMAIN/USER,user')
# Get all local groups on a remote server
powershell -c "([ADSI]'WinNT://SERVER,computer').psbase.children | where { $_.psbase.schemaClassName -eq 'group' } | foreach { ($_.name)[0]}"
# Find members of the local Administrators group on a remote server
powershell -c "$([ADSI]'WinNT://SERVER/Administrators,group').psbase.Invoke('Members') | foreach { $_.GetType().InvokeMember('ADspath', 'GetProperty', $null, $_, $null).Replace('WinNT://', '') }"
# Enable the local Administrator account on a remote server
@rodneyrehm
rodneyrehm / gist:40e7946c0cff68a31cea
Last active March 12, 2025 19:23
Diagrams for Documentation

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

@zakird
zakird / get-root-cas.ps1
Created August 23, 2014 02:05
powershell script that exports trusted root certificate authorities on Windows machine
$type = [System.Security.Cryptography.X509Certificates.X509ContentType]::Cert
get-childitem -path cert:\LocalMachine\AuthRoot | ForEach-Object {
$hash = $_.GetCertHashString()
[System.IO.File]::WriteAllBytes("$hash.der", $_.export($type) )
}
@gubatron
gubatron / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md
Last active October 12, 2024 22:57
How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

Let's say alice is a github.com user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

https://github.com/alice/repo1

https://github.com/alice/repo2

You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers.

@kgadek
kgadek / gist:e402a3edb18bd0e0682d
Created October 28, 2014 23:05
Powershell parallel
cls
"foo.txt", "bar.txt" | %{
$ScriptBlock = {
param($name)
Write-Host "[processing '$name' inside the job]"
Get-Content "$name" | %{
Write-Host "Content: $_"
}
Start-Sleep 1
@JohnLBevan
JohnLBevan / BoxStarter_AppServicesTeam.ps1
Last active August 29, 2015 14:16
This script should be used by all members of the Application Services team to ensure they have a common toolset ready to use (NB: also includes additional developer options which have been commented out / which will make up an advanced version later).
##Install Chocolatey
#iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
##Install BoxStarter
#choco install boxstarter
#
#Or simpler:
#http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/JohnLBevan/d79a6973509bf5bae425/raw/97b183bbba7946b8992e037e56f7bdb347a930be/BoxStarter_AppServicesTeam.txt
#ref: see https://github.com/mwrock/Chocolatey-Packages/blob/master/mwrock-TfsDesktop/tools/ChocolateyInstall.ps1 for a great example script
#https://gist.github.com/DavidBoike/11269706/4007b58e122dcb926cc7f0e4f134e51bfaebee78

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone [email protected]:<hash>.git     # or with ssh
@JohnLBevan
JohnLBevan / Get-LocalSecurityGroupInfo.ps1
Last active October 4, 2021 18:24
Get Local Security Group Info (PS2 compatible)
#based on code from this blog: https://mcpmag.com/articles/2015/06/18/reporting-on-local-groups.aspx
function Get-AdsiComputer {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[string]$ComputerName = $env:COMPUTERNAME
)
process {
[ADSI]("WinNT://$ComputerName,computer")
@mombrea
mombrea / DbInitializer.cs
Last active April 5, 2023 21:55
EF Core 1.0 and ASP.NET Core Identity Seed Data
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using System.Linq;
namespace My.App.Data
{
public class DbInitializer : IDbInitializer
{
private readonly ApplicationDbContext _context;
private readonly UserManager<ApplicationUser> _userManager;