Skip to content

Commit 38d6a65

Browse files
committed
Removed powershell from .gitignore
1 parent 99b5ba4 commit 38d6a65

7 files changed

Lines changed: 255 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Cargo.lock
1010
*.zip
1111
*.iso
1212
*.bat
13-
*.ps1
13+
1414

1515
# Ignore resource and automation folders
1616
tools/**

install.ps1

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# GhostWin One-Line Installer for Windows
2+
# Usage: iwr -useb https://raw.githubusercontent.com/yourusername/ghostwin/main/install.ps1 | iex
3+
4+
param(
5+
[switch]$SkipRust,
6+
[string]$InstallPath = "$env:USERPROFILE\GhostWin",
7+
[switch]$Help
8+
)
9+
10+
if ($Help) {
11+
Write-Host @"
12+
GhostWin Installer
13+
14+
Usage:
15+
iwr -useb https://your-repo/install.ps1 | iex # Full install
16+
iwr -useb https://your-repo/install.ps1 | iex -SkipRust # Skip Rust install
17+
iwr -useb https://your-repo/install.ps1 | iex -InstallPath "C:\Tools\GhostWin"
18+
19+
Options:
20+
-SkipRust Skip Rust installation (if already installed)
21+
-InstallPath Custom installation directory
22+
-Help Show this help
23+
"@
24+
exit 0
25+
}
26+
27+
$ErrorActionPreference = "Stop"
28+
29+
Write-Host "🚀 GhostWin Installation Script" -ForegroundColor Cyan
30+
Write-Host "================================" -ForegroundColor Cyan
31+
32+
# Check if running as administrator
33+
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
34+
Write-Host "⚠️ This script requires Administrator privileges for optimal setup." -ForegroundColor Yellow
35+
Write-Host " Some features may not work without admin rights." -ForegroundColor Yellow
36+
Write-Host ""
37+
}
38+
39+
# Function to check if command exists
40+
function Test-Command($cmdname) {
41+
return [bool](Get-Command -Name $cmdname -ErrorAction SilentlyContinue)
42+
}
43+
44+
# Install Rust if not present
45+
if (-not $SkipRust) {
46+
Write-Host "🔧 Checking for Rust installation..." -ForegroundColor Yellow
47+
48+
if (Test-Command "cargo") {
49+
Write-Host "✅ Rust is already installed!" -ForegroundColor Green
50+
cargo --version
51+
} else {
52+
Write-Host "📦 Installing Rust..." -ForegroundColor Yellow
53+
54+
# Download and run rustup-init
55+
$rustupUrl = "https://win.rustup.rs/x86_64"
56+
$rustupPath = "$env:TEMP\rustup-init.exe"
57+
58+
Write-Host " Downloading rustup-init.exe..." -ForegroundColor Gray
59+
Invoke-WebRequest -Uri $rustupUrl -OutFile $rustupPath
60+
61+
Write-Host " Running Rust installer (this may take a few minutes)..." -ForegroundColor Gray
62+
& $rustupPath -y --default-toolchain stable --default-host x86_64-pc-windows-msvc
63+
64+
# Refresh environment
65+
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
66+
67+
if (Test-Command "cargo") {
68+
Write-Host "✅ Rust installed successfully!" -ForegroundColor Green
69+
} else {
70+
Write-Host "❌ Rust installation failed. Please install manually from https://rustup.rs/" -ForegroundColor Red
71+
exit 1
72+
}
73+
}
74+
}
75+
76+
# Create installation directory
77+
Write-Host "📁 Creating installation directory: $InstallPath" -ForegroundColor Yellow
78+
New-Item -ItemType Directory -Path $InstallPath -Force | Out-Null
79+
80+
# Clone or download GhostWin
81+
Write-Host "⬇️ Downloading GhostWin..." -ForegroundColor Yellow
82+
83+
# Check if git is available
84+
if (Test-Command "git") {
85+
Write-Host " Using git to clone repository..." -ForegroundColor Gray
86+
git clone https://github.com/yourusername/ghostwin.git $InstallPath
87+
} else {
88+
Write-Host " Git not found, downloading ZIP..." -ForegroundColor Gray
89+
$zipUrl = "https://github.com/yourusername/ghostwin/archive/main.zip"
90+
$zipPath = "$env:TEMP\ghostwin.zip"
91+
92+
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath
93+
Expand-Archive -Path $zipPath -DestinationPath $env:TEMP -Force
94+
Move-Item "$env:TEMP\ghostwin-main\*" $InstallPath -Force
95+
Remove-Item "$env:TEMP\ghostwin-main" -Recurse -Force
96+
}
97+
98+
# Build GhostWin
99+
Write-Host "🔨 Building GhostWin..." -ForegroundColor Yellow
100+
Push-Location $InstallPath
101+
102+
try {
103+
Write-Host " Running cargo build --release (this may take several minutes)..." -ForegroundColor Gray
104+
cargo build --release
105+
106+
if (Test-Path "target\release\ghostwin.exe") {
107+
Write-Host "✅ GhostWin built successfully!" -ForegroundColor Green
108+
} else {
109+
Write-Host "❌ Build failed!" -ForegroundColor Red
110+
exit 1
111+
}
112+
} finally {
113+
Pop-Location
114+
}
115+
116+
# Add to PATH (optional)
117+
$addToPath = Read-Host "Add GhostWin to PATH? (y/N)"
118+
if ($addToPath -eq "y" -or $addToPath -eq "Y") {
119+
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
120+
$newPath = $currentPath + ";" + "$InstallPath\target\release"
121+
[Environment]::SetEnvironmentVariable("PATH", $newPath, "User")
122+
Write-Host "✅ Added to PATH. Restart your terminal to use 'ghostwin' command." -ForegroundColor Green
123+
}
124+
125+
# Validate installation
126+
Write-Host "🔍 Validating installation..." -ForegroundColor Yellow
127+
& "$InstallPath\target\release\ghostwin.exe" validate
128+
129+
Write-Host ""
130+
Write-Host "🎉 GhostWin Installation Complete!" -ForegroundColor Green
131+
Write-Host "=================================" -ForegroundColor Green
132+
Write-Host ""
133+
Write-Host "Location: $InstallPath" -ForegroundColor Cyan
134+
Write-Host "Executable: $InstallPath\target\release\ghostwin.exe" -ForegroundColor Cyan
135+
Write-Host ""
136+
Write-Host "Quick Start:" -ForegroundColor Yellow
137+
Write-Host " cd `"$InstallPath`"" -ForegroundColor Gray
138+
Write-Host " .\target\release\ghostwin.exe gui" -ForegroundColor Gray
139+
Write-Host ""
140+
Write-Host "For help: .\target\release\ghostwin.exe --help" -ForegroundColor Gray
141+
Write-Host ""
142+
Write-Host "Ready to deploy! 🚀" -ForegroundColor Green
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Get the currently active network connection
2+
$currentNetwork = Get-NetConnectionProfile | Where-Object { $_.IPv4Connectivity -eq "Internet" }
3+
4+
# Change the network category to Private if it is set to Public
5+
if ($currentNetwork.NetworkCategory -eq "Public") {
6+
Set-NetConnectionProfile -InterfaceAlias $currentNetwork.InterfaceAlias -NetworkCategory Private
7+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This script will check to see if the computer is manufacturered by Dell, download and install Dell Command Update, and attempt to install updates
2+
3+
If ($(Get-CimInstance -ClassName Win32_ComputerSystem).Manufacturer -like "*Dell*"){
4+
"Waiting for user input to continue Dell command update"
5+
6+
Start-Sleep 2
7+
8+
$Wscript_Shell = New-Object -ComObject "Wscript.Shell"
9+
$MsgBox = $Wscript_Shell.Popup("Dell command update will run automaticly in 20 seconds, press 'ok' to run now or 'cancel' to abort.", 20, "Setup Helper", 1+32)
10+
11+
If ($MsgBox -ne 1 -AND $MsgBox -ne -1) { Exit }
12+
13+
$ProgressPreference = 'SilentlyContinue';
14+
$ua='Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) AppleWebKit/534.6 (KHTML, like Gecko) Chrome/7.0.500.0 Safari/534.6';
15+
Invoke-WebRequest 'https://dl.dell.com/FOLDER11201586M/1/Dell-Command-Update-Windows-Universal-Application_0XNVX_WIN_5.2.0_A00.EXE' -useragent $ua -outfile 'dcu.exe'
16+
17+
Start-Process "dcu.exe" -Args "/s" -Wait -NoNewWindow
18+
19+
echo 'Waiting for Dell Command Update to install...'
20+
do{$count++; if(Test-Path "$env:ProgramFiles\Dell\CommandUpdate\dcu-cli.exe"){ Write-Host "Found"; Break }; Start-Sleep 1} until ($count -ge 10)
21+
22+
23+
$null = Reg.exe add "HKLM\SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\CFG" /v "ShowSetupPopup" /t REG_DWORD /d "0" /f
24+
$null = Reg.exe add "HKLM\SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\AdvancedDriverRestore" /v "IsAdvancedDriverRestoreEnabled" /t REG_DWORD /d "0" /f
25+
$null = Reg.exe add "HKLM\SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\General" /v "UserConsentDefault" /t REG_DWORD /d "0" /f
26+
$null = Reg.exe add "HKLM\SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\General" /v "SuspendBitLocker" /t REG_DWORD /d "1" /f
27+
$null = Reg.exe add "HKLM\SOFTWARE\DELL\UpdateService\Clients\CommandUpdate\Preferences\Settings\Schedule" /v "ScheduleMode" /t REG_SZ /d "ManualUpdates" /f
28+
$null = Reg.exe add "HKLM\SOFTWARE\DELL\UpdateService\Service\UpdateScheduler" /v "CurrentUpdateState" /t REG_SZ /d "WaitForScan" /f
29+
30+
31+
Start-Sleep 2
32+
33+
Start-Process "$Env:ProgramW6432\Dell\CommandUpdate\dcu-cli.exe" -Args "/scan" -Wait -NoNewWindow
34+
35+
Start-Sleep 4
36+
37+
Start-Process "$Env:ProgramW6432\Dell\CommandUpdate\dcu-cli.exe" -Args "/applyupdates" -Wait -NoNewWindow
38+
39+
PowerShell.exe -NoLogo
40+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Reduce the volume so sounds that might play during first logon or scripts running won't be disruptive
2+
3+
Add-Type -TypeDefinition @'
4+
using System.Runtime.InteropServices;
5+
6+
[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
7+
interface IAudioEndpointVolume {
8+
// f(), g(), ... are unused COM method slots. Define these if you care
9+
int f(); int g(); int h(); int i();
10+
int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext);
11+
int j();
12+
int GetMasterVolumeLevelScalar(out float pfLevel);
13+
int k(); int l(); int m(); int n();
14+
int SetMute([MarshalAs(UnmanagedType.Bool)] bool bMute, System.Guid pguidEventContext);
15+
int GetMute(out bool pbMute);
16+
}
17+
[Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
18+
interface IMMDevice {
19+
int Activate(ref System.Guid id, int clsCtx, int activationParams, out IAudioEndpointVolume aev);
20+
}
21+
[Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
22+
interface IMMDeviceEnumerator {
23+
int f(); // Unused
24+
int GetDefaultAudioEndpoint(int dataFlow, int role, out IMMDevice endpoint);
25+
}
26+
[ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")] class MMDeviceEnumeratorComObject { }
27+
28+
public class Audio {
29+
static IAudioEndpointVolume Vol() {
30+
var enumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
31+
IMMDevice dev = null;
32+
Marshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(/*eRender*/ 0, /*eMultimedia*/ 1, out dev));
33+
IAudioEndpointVolume epv = null;
34+
var epvid = typeof(IAudioEndpointVolume).GUID;
35+
Marshal.ThrowExceptionForHR(dev.Activate(ref epvid, /*CLSCTX_ALL*/ 23, 0, out epv));
36+
return epv;
37+
}
38+
public static float Volume {
39+
get {float v = -1; Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out v)); return v;}
40+
set {Marshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value, System.Guid.Empty));}
41+
}
42+
public static bool Mute {
43+
get { bool mute; Marshal.ThrowExceptionForHR(Vol().GetMute(out mute)); return mute; }
44+
set { Marshal.ThrowExceptionForHR(Vol().SetMute(value, System.Guid.Empty)); }
45+
}
46+
}
47+
'@
48+
49+
[Audio]::Volume = 0.20
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Create shortcuts on the current users desktop to some common admin tasks
2+
3+
$WshShell = New-Object -comObject WScript.Shell
4+
5+
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\System Properties.lnk")
6+
$Shortcut.TargetPath = "SystemPropertiesComputerName.exe"
7+
$Shortcut.Save()
8+
9+
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Users Managment.lnk")
10+
$Shortcut.TargetPath = "lusrmgr.msc"
11+
$Shortcut.Save()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Remove the run at logon registry value
2+
# This is the run command that triggers the logon scripts to run, once it's run it's no longer needed
3+
$RegKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
4+
$RegName = Get-Item $RegKey | Select-Object -ExpandProperty Property | Where-Object { $_ -like "*Unattend*" }
5+
Remove-ItemProperty $RegKey -Name $RegName

0 commit comments

Comments
 (0)