Skip to content

Instantly share code, notes, and snippets.

View eponerine's full-sized avatar
🏌️

Ernie Costa eponerine

🏌️
View GitHub Profile
@eponerine
eponerine / Capture-AppReadinessBug.ps1
Created December 31, 2024 22:04
Capture-AppReadinessBug
#Remote Powershell into an affected AVD VM
Enter-PSSession -ComputerName "AVD-XX-YYY"
#Download PROCDUMP
#If the folder already exists, mkdir may fail
mkdir "C:\PROCDUMP"
chdir "C:\PROCDUMP"
Start-BitsTransfer "https://download.sysinternals.com/files/Procdump.zip"
Expand-Archive -Path "C:\PROCDUMP\Procdump.zip" -DestinationPath "C:\PROCDUMP" -Force
Remove-Item "C:\PROCDUMP\Procdump.zip"
$imagePath = "D:\Temp\install.wim"
$driverPackagePath = "D:\Temp\Drivers"
$workingDirPath = "D:\Temp\WIMWORK"
###########
$imageFiles = Get-WindowsImage -ImagePath $imagePath
ForEach ($i in $imageFiles) {
Write-Output "Index $($i.ImageIndex) - $($i.ImageName)"
@eponerine
eponerine / Fix-CrowdStrikeBugViaSCVMM.ps1
Last active July 22, 2024 16:20
Fix-CrowdStrikeBugViaSCVMM.ps1
#########################################
# Fix-CrowdStrikeBugViaSCVMM.ps1
# Created by Ernie Costa
#########################################
# Original script written by Yusuf Ozturk and the VirtualMetric crew
# https://www.linkedin.com/pulse/crowdstrike-bug-fix-azure-stack-hci-yusuf-%25C3%25B6zt%25C3%25BCrk-elw0e
#
# Usage:
# Run at your own risk - make sure to scan thru EVERYTHING and ensure it will work for your environment.
# You obviously need SCVMM and a collection of hostnames. Put the hostnames as an array of strings and run!
@eponerine
eponerine / breakout.asm
Created April 9, 2024 18:59
Breakout in x86 ASM
TITLE BreakOut
INCLUDE Irvine16.inc
.data
TitleStr BYTE " _ _ _ _ _ _ _ _ ",10,13,
" / \_/ \_/ \_/ \_/ \_/ \_/ \_/ \ ",10,13,
" ( B _ R _ E _ A _ K _ O _ U _ T )",10,13,
" \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ ",0
$groupNames = @("Ernie-TestGroup001","Ernie-TestGroup002")
$ownerEmails = @("jane@contoso.com","bob@contoso.com","omar@contoso.com")
################################################################
# Login
Connect-AzureAd
ForEach ($g in $groupNames) {
@eponerine
eponerine / Create-BulkEnterpriseApplications.ps1
Created March 22, 2024 16:22
When you gotta create a bunch of Enterprise Applications at the same time
$enterpriseAppNames = @("EnterpriseApp-ErnieTest010","EnterpriseApp-ErnieTest011")
$ownerEmails = @("bob@contoso.com","jane@contoso.com","omar@contoso.com")
###########################################################################
# Login
Connect-AzureAd
# Create each app, one at a time
ForEach ($e in $enterpriseAppNames) {
Install-WindowsFeature -Name EnhancedStorage
Import-Module -Name VMDirectStorage
Get-Command -Module VMDirectStorage
PS C:\> Get-Command -Module VMDirectStorage
CommandType Name Version Source
----------- ---- ------- ------
@eponerine
eponerine / Enable-WERFullProcessDumps.ps1
Created February 2, 2024 14:17
Enable-WERFullProcessDumps
# https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
# Change this to wherever you want the dumps to go
# I personally like a CSV if doing this on Hyper-V cluster; easier to gather logs in central place
$dumpFolderPath = "C:\ClusterStorage\VMLTRACE-01\FullDumps\$env:ComputerName"
# VMMS.exe
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "vmms.exe" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\vmms.exe" -Name "DumpFolder" -PropertyType String -Value $dumpFolderPath
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\vmms.exe" -Name "DumpCount" -PropertyType DWORD -Value 4
@eponerine
eponerine / Get-SessionDPI.ps1
Created February 1, 2024 17:23
Get-SessionDPI
Add-Type @'
using System;
using System.Runtime.InteropServices;
using System.Drawing;
public class DPI {
[DllImport("gdi32.dll")]
static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
public enum DeviceCap {
@eponerine
eponerine / Get-FizzBuzz.ps1
Last active January 30, 2024 18:04
Fizz Buzz in PowerShell
For ($i=1; $i -le 100; $i++) {
$responseString = ""
If ( !($i % 3) ) { $responseString += "Fizz" }
If ( !($i % 5) ) { $responseString += "Buzz" }
If ( ($i % 3) -and ($i % 5) ) { $responseString += $i }
Write-Output $responseString
}