Skip to content

Instantly share code, notes, and snippets.

View JimMoyle's full-sized avatar

Jim Moyle JimMoyle

View GitHub Profile
@JimMoyle
JimMoyle / MsixFrameWorkInstallScript.ps1
Last active March 7, 2025 23:41
Install MSIX frameworks
$frameWorkList = 'Microsoft.WindowsAppRuntime', 'Microsoft.UI.Xaml', 'Microsoft.VCLibs', 'Microsoft.NET.Native.Runtime', 'Microsoft.NET.Native.Framework', 'Microsoft.WindowsAppRuntime.CBS'
foreach ($framework in $frameWorkList) {
if($framework -eq 'Microsoft.WindowsAppRuntime') {
$download = 'Microsoft.WindowsAppSDK'
}
else{
$download = $framework
}
@JimMoyle
JimMoyle / PowerPoint_animation_randomization.ps1
Last active May 20, 2024 04:55
Copy randomize and paste animations in Powerpoint
$shapeName = 'Rounded Rectangle 664'
Add-type -AssemblyName office
$Application = New-Object -ComObject powerpoint.application
$application.visible = [Microsoft.Office.Core.MsoTriState]::msoTrue
$powerpointFile = "D:\PoSHCode\GitLocal\PowerPoint\RandomLogoff3.pptx"
$presentation = $application.Presentations.open($powerpointFile)
@JimMoyle
JimMoyle / ConvertTo-RawIcon.ps1
Last active February 21, 2024 10:18
PowerShell to convert icon to use with Azure Virtual Desktop (AVD) App Attach
$Path = 'c:\myicon.png'
$Bytes = get-content $Path -AsByteStream -Raw
$inputFromBase64conv = [convert]::ToBase64String($Bytes)
$out = [System.Convert]::FromBase64String($inputFromBase64conv)
Write-Output $out
$stopwatch = [system.diagnostics.stopwatch]::StartNew()
while ($true) { $stopwatch.Elapsed.ToString().SubString(0, 8); Start-Sleep 1; Clear-Host}
function Get-WpmRestApp {
[CmdletBinding()]
Param (
[Parameter(
Position = 0,
ValuefromPipelineByPropertyName = $true,
ValuefromPipeline = $true,
Mandatory = $true
@JimMoyle
JimMoyle / PoShPascalCaseRegex.ps1
Last active November 8, 2023 10:17
Regex to Match a PowerShell cmdlet name or parameter in Pascal Case including Acronyms
$cmdletName -cmatch "^(?:[A-Z]{1,3}(?:[a-z0-9_])+)+[A-Z]{0,2}-(?:[A-Z]{1,3}(?:[a-z0-9_])+)+[A-Z]{0,2}$"
$parameterName -cmatch '^(?:[A-Z]{1,3}(?:[a-z0-9_])+)+[A-Z]{0,2}$'
@JimMoyle
JimMoyle / emailclean.ps1
Last active February 20, 2024 11:12
Cleanup emails from outlook format
<#
If the email is in the format below
Jim Moyle <[email protected]>
it will be cleaned up by the replace regex to this one:
[email protected]
#>
@JimMoyle
JimMoyle / Get-FslCompactionInfo.ps1
Created September 9, 2022 12:59
Get FSLogix Disk Compaction Information from Event Log
$diskCompactionEvents = Get-WinEvent -FilterHashtable @{
LogName = 'Microsoft-FSLogix-Apps/Operational'
ID = 57
}
foreach ($event in $diskCompactionEvents) {
$out = [PSCustomObject]@{
ImagePath = $event.Properties[0].Value
'TimeTaken(ms)' = $event.Properties[7].Value
'InitialSize(MB)' = $event.Properties[4].Value
#Requires -RunAsAdministrator
#Requires -Modules 'Hyper-V'
# Once this has been run once, you will be able to use the Invokle-ShrinkFslDisk tool to get max shrink from all disks, without having to copy.
# Required Services = 'defragsvc', 'vds', 'smphost' ! This script will fail if you don't have these services running !
# Change the source and target path as needed
# Run from a VM with FSLogix installed
# Does not need to be run on a FileServer
@JimMoyle
JimMoyle / Get-AzureVmPrice.ps1
Created March 10, 2021 14:16
Get Azure VM price from API with PowerShell
[CmdletBinding()]
Param (
[Parameter(
ValuefromPipelineByPropertyName = $true,
ValuefromPipeline = $true,
Mandatory = $true
)]
[System.String]$vmSKU,