From d01c7ec2a8bf11db661b696d7c302ea5e8a8f3e3 Mon Sep 17 00:00:00 2001 From: USER Date: Fri, 29 Aug 2025 15:48:59 +0100 Subject: [PATCH] . --- bin/SoftwareList.bat | 10 ++++++++++ bin/SpeedUp.ps1 | 18 ++++++++++++++++++ bin/SpeedUpPS.bat | 11 +++++++++++ 3 files changed, 39 insertions(+) create mode 100755 bin/SoftwareList.bat create mode 100755 bin/SpeedUp.ps1 create mode 100644 bin/SpeedUpPS.bat diff --git a/bin/SoftwareList.bat b/bin/SoftwareList.bat new file mode 100755 index 0000000..27941f3 --- /dev/null +++ b/bin/SoftwareList.bat @@ -0,0 +1,10 @@ +@echo off +set check_computername=%COMPUTERNAME% +echo "Found computer %check_computername%" + +set PACKAGES="C:\Packages" +set WPUBLIC="C:\wPublic" + +echo "Dump software list" +set PSFILE="%WPUBLIC%\bin\ListSoftware.ps1" +Powershell.exe -ExecutionPolicy Bypass -File %PSFILE% > "C:\%check_computername%.txt" diff --git a/bin/SpeedUp.ps1 b/bin/SpeedUp.ps1 new file mode 100755 index 0000000..4055d5e --- /dev/null +++ b/bin/SpeedUp.ps1 @@ -0,0 +1,18 @@ +function Optimize-PowershellAssemblies { + # NGEN powershell assembly, improves startup time of powershell by 10x + $old_path = $env:path + try { + $env:path = [Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory() + [AppDomain]::CurrentDomain.GetAssemblies() | % { + if (! $_.location) {continue} + $Name = Split-Path $_.location -leaf + if ($Name.startswith("Microsoft.PowerShell.")) { + Write-Progress -Activity "Native Image Installation" -Status "$name" + ngen install $_.location | % {"`t$_"} + } + } + } finally { + $env:path = $old_path + } +} +Optimize-PowershellAssemblies diff --git a/bin/SpeedUpPS.bat b/bin/SpeedUpPS.bat new file mode 100644 index 0000000..289a287 --- /dev/null +++ b/bin/SpeedUpPS.bat @@ -0,0 +1,11 @@ +@echo off +set check_computername=%COMPUTERNAME% +echo "Found computer %check_computername%" + +set PACKAGES="C:\Packages" +set WPUBLIC="C:\wPublic" + +echo "Speed up Powershell processing" +set PSFILE="%WPUBLIC%\bin\SpeedUp.ps1" +Powershell.exe -ExecutionPolicy Bypass -File %PSFILE% +