Skip to content

Instantly share code, notes, and snippets.

@everydayintech
everydayintech / ZipFile.ps1
Last active July 27, 2025 15:36
Sane ZIP functions for your PowerShell profile. Create a ZIP archive of a specified directory in the current location without nesting.
function MkZip {
[CmdletBinding()]
param (
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true
)]
[string]$Directory
)
@everydayintech
everydayintech / MakeIso.ps1
Last active September 24, 2025 11:54
Create a bootable Windows ISO file from a folder using oscdimg.exe
function MakeIso {
param (
[string]$SourceFolder,
[string]$ISOFile
)
Start-Process oscdimg.exe -ArgumentList "-m -o -u2 -udfver102 -bootdata:2#p0,e,b$SourceFolder\boot\etfsboot.com#pEF,e,b$SourceFolder\efi\microsoft\boot\efisys.bin $SourceFolder $ISOFile" -Wait
}
@everydayintech
everydayintech / FileClipboard.ps1
Last active May 1, 2025 12:13
Copy files as text with system clipboard
function ClipFile {
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$FilePath
)
try {
$Item = Get-Item -Path $FilePath -ErrorAction Stop
}
catch {
@everydayintech
everydayintech / Remove-ItemToRecycleBin.ps1
Created April 2, 2024 19:13
Moves a file or directory to the Recycle Bin
<#
.SYNOPSIS
Moves a file or directory to the Recycle Bin.
.DESCRIPTION
The Remove-ItemToRecycleBin function moves a specified file or directory to the Recycle Bin.
It uses the Microsoft.VisualBasic.FileIO.FileSystem class to perform the operation.
Original author: Ste (https://stackoverflow.com/users/8262102/ste)
Improved by: everydayintech (github.com/everydayintech)
@everydayintech
everydayintech / IntuneDependencyGraph.ps1
Created March 7, 2024 15:09
Intune App Dependency Analysis
Import-Module Microsoft.Graph.Beta.Devices.CorporateManagement -ErrorAction Stop
$ReadAllScopes = @(
"DeviceManagementApps.Read.All"
)
Connect-MgGraph -NoWelcome -Scopes $ReadAllScopes
$WindowsAppsFilter = "(isof('microsoft.graph.win32CatalogApp') or isof('microsoft.graph.windowsStoreApp') or isof('microsoft.graph.microsoftStoreForBusinessApp') or isof('microsoft.graph.officeSuiteApp') or (isof('microsoft.graph.win32LobApp') and not(isof('microsoft.graph.win32CatalogApp'))) or isof('microsoft.graph.windowsMicrosoftEdgeApp') or isof('microsoft.graph.windowsPhone81AppX') or isof('microsoft.graph.windowsPhone81StoreApp') or isof('microsoft.graph.windowsPhoneXAP') or isof('microsoft.graph.windowsAppX') or isof('microsoft.graph.windowsMobileMSI') or isof('microsoft.graph.windowsUniversalAppX') or isof('microsoft.graph.webApp') or isof('microsoft.graph.windowsWebApp') or isof('microsoft.graph.winGetApp')) and (microsoft.graph.managedApp/appAvailability eq null or microsoft.graph.managedApp/appAvailability eq
@everydayintech
everydayintech / PS32toPS64.ps1
Last active January 25, 2024 16:15
Run PowerShell Script in 64-bit PowerShell from a 32-bit PowerShell Process on 64-bit OS
# Original Script: https://z-nerd.com/blog/2020/03/31-intune-win32-apps-powershell-script-installer/
# Added Exit Code handling by: baartch
# Improved Exit Code handling by: https://github.com/everydayintech
If ($ENV:PROCESSOR_ARCHITEW6432 -eq 'AMD64') {
Write-Host 'Detected 32-bit PowerShell on 64-Bit OS, starting 64-bit PowerShell process...'
$argsString = ''
Try {
foreach ($k in $MyInvocation.BoundParameters.keys) {
switch ($MyInvocation.BoundParameters[$k].GetType().Name) {
[
{
"CatalogVersion": "23.01.08",
"Status": null,
"Component": "DriverPack",
"ReleaseDate": "21.05.06",
"Manufacturer": "Microsoft",
"Model": "Surface 3",
"Product": "Surface_3",
"Name": "Microsoft Surface 3 WiFi Win10 18362",
@everydayintech
everydayintech / autounattend.xml
Last active June 5, 2023 11:45
autounattend.xml sample for zero touch Windows installation from USB or ISO
<?xml version="1.0" encoding="UTF-8"?>
<!--
autounattend.xml sample for silent Windows installation (intended for LAB USE only)
- Mofify Image index as needed, index 5 is Windows 11 Pro (most of the time)
- Modify Administrator password, default is: changeMePlease
- Modify language and keyboard as needed, assumes en-us image with swiss german keyboard layout
- Tested with Windows 11 22H2
-> put this file in root directory of a Windows installation media or
copy content of downloaded ISO (C:\ISOFILES) from Microsoft and generate custom ISO (C:\WIN11.iso) with Oscdimg:
$CurrentDir = if($null -eq $MyInvocation.MyCommand.Path){Get-Location | Select-Object -ExpandProperty Path} else{Split-Path -Parent -Path $MyInvocation.MyCommand.Path}
$Filename = Read-Host -Prompt "Enter Filename"
$SecretFile = (Join-Path $CurrentDir $Filename)
Read-Host -AsSecureString -Prompt "Enter Secret" | ConvertFrom-SecureString | Out-File $SecretFile
$win32PointingDevices = Get-CimInstance win32_POINTINGDEVICE
$availablePointingDevices = @()
foreach($item in $win32PointingDevices)
{
try
{
$ffw = Get-ItemProperty "Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\$($item.PNPDeviceID)\Device Parameters" -Name 'FlipFlopWheel' -ErrorAction Stop
$availablePointingDevices += [PSCustomObject]@{