-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreate-Executable.ps1
More file actions
30 lines (25 loc) · 954 Bytes
/
Create-Executable.ps1
File metadata and controls
30 lines (25 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Script to create executable from RAMOptimizer.ps1
Write-Host "Creating RAM Optimizer Executable..." -ForegroundColor Cyan
# Check if PS2EXE module is installed
if (-not (Get-Module -ListAvailable -Name PS2EXE)) {
Write-Host "Installing PS2EXE module..." -ForegroundColor Yellow
Install-Module -Name PS2EXE -Force -Scope CurrentUser
}
# Import the module
Import-Module PS2EXE
# Create the executable
try {
Write-Host "Converting PowerShell script to executable..." -ForegroundColor Yellow
$params = @{
InputFile = "RAMOptimizer.ps1"
OutputFile = "RAMOptimizer.exe"
NoConsole = $false
RequireAdmin = $true
}
Invoke-PS2EXE @params
Write-Host "Executable created successfully!" -ForegroundColor Green
Write-Host "Output file: $(Resolve-Path RAMOptimizer.exe)" -ForegroundColor Cyan
}
catch {
Write-Host "Error creating executable: $($_.Exception.Message)" -ForegroundColor Red
}