Skip to content

Instantly share code, notes, and snippets.

View felickz's full-sized avatar
:octocat:
ALL YOUR REBASE ARE BELONG TO US.

Chad Bentz felickz

:octocat:
ALL YOUR REBASE ARE BELONG TO US.
View GitHub Profile
@felickz
felickz / GetPrivateIpForVmSSInstances.ps1
Created October 24, 2020 01:13
Get Private Ip for each instance of a VM Scaleset
$VmIps=@{}; Get-AzVmSS | %{ $VmSS = $_; (Get-AzNetworkInterface -VirtualMachineScaleSetName $VmSS.Name -ResourceGroupName $VmSS.ResourceGroupName ) | %{ $nics = $_; $nics| %{ [string[]]$VmIps[(Get-AzVmSsVm -VMScaleSetName $VmSS.Name -ResourceGroupName $VmSS.ResourceGroupName -InstanceId $_.VirtualMachine.Id.tostring().split('/')[-1]).OsProfile.ComputerName]+=$_.IpConfigurations.PrivateIpAddress} } }; $VmIps
@felickz
felickz / GetAzKeyVaultKeyModulus.ps1
Last active January 7, 2021 21:03
Get the RSA modulus from key in Azure Keyvault
$($(Get-AzKeyVaultKey -VaultName $Vault -Name $Name).Key.ToString() | ConvertFrom-Json).n
@felickz
felickz / LogAnalytics-SecurityEvents-ByType.KQL
Created January 7, 2021 21:02
Query to analyze which Azure Sentinel SecurityEvent event types you are capturing to fine tune your logging data ingestion
//https://docs.microsoft.com/en-us/azure/sentinel/connect-windows-security-events
let Minimal = dynamic ([1102, 4624, 4625, 4657, 4663, 4688, 4700, 4702, 4719, 4720, 4722, 4723, 4724, 4727, 4728, 4732, 4735, 4737, 4739, 4740, 4754, 4755, 4756, 4767, 4799, 4825, 4946, 4948, 4956, 5024, 5033, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8222]);
let Common = dynamic( [1, 299, 300, 324, 340, 403, 404, 410, 411, 412, 413, 431, 500, 501, 1100, 1102, 1107, 1108, 4608, 4610, 4611, 4614, 4622, 4624, 4625, 4634, 4647, 4648, 4649, 4657, 4661, 4662, 4663, 4665, 4666, 4667, 4688, 4670, 4672, 4673, 4674, 4675, 4689, 4697, 4700, 4702, 4704, 4705, 4716, 4717, 4718, 4719, 4720, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4733, 4732, 4735, 4737, 4738, 4739, 4740, 4742, 4744, 4745, 4746, 4750, 4751, 4752, 4754, 4755, 4756, 4757, 4760, 4761, 4762, 4764, 4767, 4768, 4771, 4774, 4778, 4779, 4781, 4793, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4825, 4826, 4870, 4886, 4887, 4888, 4893, 4898, 4902, 4904, 4905, 4907, 4931, 4932, 49
@felickz
felickz / Get-AzPublicIps.ps1
Created February 6, 2021 03:41
Az Powershell to inventory all Public IP in available subscriptions
#Get all IPs for accessible subscriptions
#Only Enabled Subs
$subscriptionList = Get-AzSubscription | where-object State -eq "Enabled"
$all = $null
foreach($sub in $subscriptionList)
{
$context = Set-AzContext -Subscription $sub.Id -Tenant $sub.TenantId
@felickz
felickz / PresentationTemplate.md
Last active March 18, 2021 17:27
PresentationTemplate
  1. Problem Statement
  2. Goal
  3. Industry Standards
  4. How to fix
$breakTimeMin = 10; 0..($breakTimeMin-1)|%{ Write-Progress -Activity "<Conference Name Goes Here>" -Status "next session begins in: $($breakTimeMin - $_) minutes" -PercentComplete ($_ / $breakTimeMin * 100); sleep 60; }
$symbols = '!@#$%^&*'.ToCharArray()
$characterList = 'a'..'z' + 'A'..'Z' + '0'..'9' + $symbols
function GeneratePassword {
param(
[Parameter(Mandatory = $false)]
[ValidateRange(12, 256)]
[int]
$length = 14
)
@felickz
felickz / logman-iis-dotnet-cf.txt
Created June 21, 2021 15:28
.NET Perfmon Counters
\.NET CLR Exceptions(w3wp)\# of Exceps Thrown
\.NET CLR Exceptions(w3wp)\# of Exceps Thrown / sec
\.NET CLR Exceptions(w3wp)\# of Filters / sec
\.NET CLR Exceptions(w3wp)\# of Finallys / sec
\.NET CLR Exceptions(w3wp)\Throw To Catch Depth / sec
\.NET CLR LocksAndThreads(w3wp)\# of current logical Threads
\.NET CLR LocksAndThreads(w3wp)\# of current physical Threads
\.NET CLR LocksAndThreads(w3wp)\# of current recognized threads
\.NET CLR LocksAndThreads(w3wp)\# of total recognized threads
\.NET CLR LocksAndThreads(w3wp)\Contention Rate / sec
@felickz
felickz / PrintOdd.ps1
Created October 25, 2021 20:38
Write script that prints out odd numbers between 1 and 10
1..10 | %{ $_ % 2 -eq 0 ? $null : (Write-Host "$_") }
@felickz
felickz / GitHubDependencyInsightsCopyLeft.url
Created December 21, 2022 20:33
GitHub Org Insights Dependencies - CopyLeft License Filter
javascript:window.location.href=window.location.href+'?query=license%3AGPL-2.0+license%3AGPL-3.0+license%3ALGPL-2.0+license%3ALGPL-3.0+license%3AAGPL-1.0+license%3AAGPL-1.0-only+license%3AAGPL-1.0-or-later+license%3AAGPL-3.0+license%3AAGPL-3.0-only+license%3AAGPL-3.0-or-later+license%3ARPL-1.1+license%3ARPL-1.5+license%3ARPSL-1.0+license%3AOCLC-2.0+license%3ANGPL+license%3AODbL-1.0+license%3AMS-RL+license%3AOSL-1.0+license%3AOSL-1.1+license%3AOSL-2.0+license%3AOSL-2.1+license%3AOSL-3.0+license%3AMPL-2.0+license%3AMPL-1.0+license%3AMPL-1.1+license%3AMPL-2.0-no-copyleft-exception+license%3AEPL-1.0+license%3AEPL-2.0%27;