Skip to content

Instantly share code, notes, and snippets.

View kevinblumenfeld's full-sized avatar
🎯
Focusing

Kevin Blumenfeld kevinblumenfeld

🎯
Focusing
View GitHub Profile
@f-bader
f-bader / GetAllRegisterdaaGuids.ps1
Last active April 14, 2024 19:46
List all AAGUIDs in an Entra ID / Azure AD tenant
# looking for a all in one solution?
# https://github.com/f-bader/EntraIDPasskeyHelper
Connect-MGGraph -UseDeviceAuthentication -Scopes "AuditLog.Read.All", "UserAuthenticationMethod.Read.All"
$NextUri = "https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails?`$filter=methodsRegistered/any(x:x eq 'passKeyDeviceBound')"
do {
$Result = Invoke-MgGraphRequest -Uri $NextUri
$NextUri = $Result['@odata.nextLink']
$ReturnValue += $Result['value']
@awakecoding
awakecoding / Get-AadJoinInformation.ps1
Created August 8, 2023 14:21
Get Azure AD (Entra ID) Join Information without dsregcmd
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
public enum DSREG_JOIN_TYPE {
DSREG_UNKNOWN_JOIN = 0,
DSREG_DEVICE_JOIN = 1,
DSREG_WORKPLACE_JOIN = 2
}
az login
az account set --subscription 'Visual Studio Enterprise'
az group create --name poshcore4 --location 'EASTUS2'
az servicebus namespace create --resource-group 'poshcore4' --name 'poshcore4' --location 'EASTUS2' --sku Basic
az servicebus queue create --resource-group 'poshcore4' --namespace-name 'poshcore4' --name messages --lock-duration "0:00:30" --default-message-time-to-live "0:01:00" --max-delivery-count 10 --max-size 1024 --enable-partitioning false --enable-dead-lettering-on-message-expiration true
az servicebus queue authorization-rule create --resource-group 'poshcore4' --namespace-name 'poshcore4' --queue-name messages --name receive --rights Listen
@adamrushuk
adamrushuk / Publish-AzDOArtifactFeed.ps1
Created June 20, 2019 20:54
Publish a PowerShell Module to an Internal Azure DevOps Artifacts feed
[CmdletBinding()]
param (
[string]$AzDOAccountName = 'adamrushuk',
[string]$AzDOArtifactFeedName = 'dev',
[string]$AzDOPat,
[string]$ModuleFolderPath = (Join-Path -Path $env:SYSTEM_ARTIFACTSDIRECTORY -ChildPath "PowerShellPipeline\PSModule\PSvCloud")
)
# Variables
$feedUsername = 'NotChecked'
@Jaykul
Jaykul / GitVersion.yml
Last active May 16, 2022 00:38
A starter pipeline for Azure DevOps for modules
mode: Mainline
next-version: 1.0.0
assembly-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILDCOUNT ?? 0}'
assembly-informational-format: '{NuGetVersionV2}+Build.{env:BUILDCOUNT ?? 0}.Date.{CommitDate}.Branch.{env:SAFEBRANCHNAME ?? unknown}.Sha.{Sha}'
commit-date-format: yyyyMMddTHHmmss
commit-message-incrementing: MergeMessageOnly
branches:
master:
tag: beta
increment: Minor

Credit: Mark Krauss
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.

Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.