Skip to content

Instantly share code, notes, and snippets.

@jrotello
jrotello / jobs.ps1
Last active November 2, 2016 16:10
PowerShell Jobs Example
param(
$MaxJobs = $env:NUMBER_OF_PROCESSORS
)
$elapsed = [System.Diagnostics.Stopwatch]::StartNew()
$jobs = @()
1..25 | % {
$running = Get-Job -State Running
@jrotello
jrotello / GetInstalledNetFrameworkVersions.ps1
Created January 21, 2016 19:39
Get-InstalledNetFrameworkVersions
# Reference: https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
function Get-InstalledNetFrameworkVersions() {
[CmdletBinding()]
Param()
Write-Verbose "Installed .NET Framework Versions"
$path = 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP'
ls $path | % {
@jrotello
jrotello / ChangeNetworkProfile.ps1
Created November 28, 2015 04:52
Change network profile from Public to Private
Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceIndex <ndx> -NetworkCategory Private
@jrotello
jrotello / gist:86692721fcb65962bd89
Last active August 29, 2015 14:21
Clean git repository, but exclude local.config file.
# Git Repo
git clean -d -x -e Development/local.config -f
#TFS Repo
tfpt treeclean /noprompt /recursive /exclude:local.config
@jrotello
jrotello / AzureADOpenIdConnect.ps1
Created March 15, 2015 01:10
Helper functions for retrieving OpenId Connect metadata from Microsoft Azure AD.
function Get-AzureADOpenIdConnectMetadata() {
param(
[string]
$tenant = "common"
)
$metadata_url = "https://login.windows.net/{0}/.well-known/openid-configuration" -f $tenant
Invoke-RestMethod $metadata_url
}
@jrotello
jrotello / Get-TfsMergeCandidates.ps1
Last active August 29, 2015 14:15
Gets a list of all changesets from $Source branch that have not been merged into $Destination branch.
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client") | Out-Null
<#
.Synopsis
Gets a list of all changesets from $Source that have not been merged into $Destination.
.DESCRIPTION
Gets a list of all changesets from $Source that have not been merged into $Destination.
.EXAMPLE
$tfs = Get-TfsServer http://<hostname>:8080/tfs
Get-MergeCandidates -Server $tfs -Source "$/Some/Source/Branch" -Destination "$/Some/Destinsation/Branch"
@jrotello
jrotello / ListNugetPackages.ps1
Last active August 29, 2015 14:10
Recursively find the packages.config files and generate a unique list of all the Nuget packages in use.
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
$Path
)
$packages = @()
ls -Path $Path -Include packages.config -Recurse -File | % {
$xml = [xml](Get-Content $_)
@jrotello
jrotello / index.cshtml
Created November 18, 2014 15:08
Server Information - Like phpinfo() for ASP.NET
<!DOCTYPE html>
<html>
<head>
<title>Server Information</title>
</head>
<body>
@ServerInfo.GetHtml()
</body>
</html>
@jrotello
jrotello / SetCopyLocal.ps1
Created October 24, 2014 15:07
PowerShell script to force "Copy Local" in .csproj files.
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
$RootDir,
[string[]]$Assemblies = @(
'System.Net.Http.Formatting',
'System.Web.Http',
'System.Web.Http.WebHost',
'System.Web.Mvc'
)
@jrotello
jrotello / gist:daa16f3cb4af4135efd2
Last active August 29, 2015 14:07
Set the managed runtime version for an IIS AppPool
Import-Module WebAdministration
Set-ItemProperty IIS:\AppPools\<pool_name> managedRuntimeVersion v4.0