Skip to content

Instantly share code, notes, and snippets.

@irwins
irwins / Set-ADSearchBase-Intellisense.ps1
Last active May 3, 2017 03:02
Create Custom Intellisense for AD cmdlets with SearchBase parameter using TabExpansion++ Module
<#
Author: I.C.A. Strachan
Version:
Version History:
Purpose: Custom Intellisense completion for AD cmdlets with SearchBase parameter
ActiveDirectory & TabExpansion++ module is required.
[CmdletBinding()]
Param (
[ValidateScript({ Test-Path $_ } )]
[string]$ChessMatchesPath = 'C:\Users\Irwin\Downloads\ChessData-master\ChessData-master',
[switch]$DisplaySumTotal
)
#region Define regex results. Make search case-insensitive just incase.
[regex]$whiteWin = '(?i)result\s+"1-0"'
@irwins
irwins / New-ADUsersFromCSV.ps1
Last active October 21, 2018 18:36
Infrastructure validation script using the Arrange Act Assert principle for creating users from a CSV file
<#
Author: I.C.A. Strachan
Version:
Version History:
Purpose: Infrastructure validation script to create ADUser from CSV file
#>
<#
Author: I. Strachan
Version: 1.0
Version History:
Purpose: Get az devops projects wrapper
#>
@irwins
irwins / randomuser.go
Created March 28, 2021 18:27
Get random user in go
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@irwins
irwins / Trace-AICommand.ps1
Created July 18, 2022 19:23 — forked from JustinGrote/Trace-AICommand.ps1
Report the results and performance of any scriptblock to Azure Application Insights
#requires -version 7
#You can load this script with $(iwr https://tinyurl.com/TraceAICommand | iex)
using namespace Microsoft.ApplicationInsights
using namespace Microsoft.ApplicationInsights.Extensibility
using namespace Microsoft.ApplicationInsights.DataContracts
using namespace System.Management.Automation
using namespace System.Collections.Generic
using namespace System.Net
#Reference: https://docs.microsoft.com/en-us/azure/azure-monitor/app/console
@irwins
irwins / Get-MgServicePrincipalPermission.ps1
Created December 2, 2022 07:02 — forked from JustinGrote/Get-MgServicePrincipalPermission.ps1
Get a list of application and delegated permissions for a service principal, similar to what the Azure Portal shows
#requires -version 7
using namespace Microsoft.Graph.PowerShell.Models
using namespace System.Collections.Generic
function Get-MgServicePrincipalPermission {
param(
[Parameter(ParameterSetName='Id',ValueFromPipelineByPropertyName)][Alias('Id')][string]$ServicePrincipalId,
[Parameter(ParameterSetName='Object',ValueFromPipeline)][MicrosoftGraphServicePrincipal]$ServicePrincipal
)
begin {
@irwins
irwins / readme.md
Last active January 9, 2024 17:44
PowerShell RSV