Skip to content

Commit

Permalink
Merge pull request #683 from Ana06/installer
Browse files Browse the repository at this point in the history
Installer improvements
  • Loading branch information
Ana06 authored Oct 12, 2023
2 parents 3f7926c + 2aac048 commit 74f5d30
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/installer.vm/installer.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>installer.vm</id>
<version>0.0.0.20230904</version>
<version>0.0.0.20231009</version>
<authors>Mandiant</authors>
<description>Generic installer for custom virtual machines.</description>
<dependencies>
Expand Down
26 changes: 19 additions & 7 deletions packages/installer.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ try {

# Set Profile/Version specific configurations
VM-Write-Log "INFO" "[+] Beginning Windows OS VM profile configuration changes"
$configFile = Join-Path $Env:VM_COMMON_DIR "config.xml" -Resolve
VM-Apply-Configurations $configFile
$configPath = Join-Path $Env:VM_COMMON_DIR "config.xml" -Resolve
VM-Apply-Configurations $configPath

# Configure PowerShell and cmd prompts
VM-Configure-Prompts

# Configure PowerShell Logging
VM-Configure-PS-Logging

# Configure Desktop\Tools folder with a custom icon
if ($iconPath = Join-Path $Env:VM_COMMON_DIR "vm.ico" -Resolve) {
# Configure Desktop\Tools folder with a custom icon if it exists
$iconPath = Join-Path $Env:VM_COMMON_DIR "vm.ico"
if (Test-Path $iconPath) {
$folderPath = $Env:TOOL_LIST_DIR
# Set the icon
if (Test-Path -Path $folderPath -PathType Container) {
Expand Down Expand Up @@ -121,13 +122,24 @@ try {
Write-Host "`t[-] %LOCALAPPDATA%\Boxstarter\boxstarter.log" -ForegroundColor Yellow
}

# Let users know installation is complete by setting background, playing win sound, and display message box
# Set background
# Let users know installation is complete by setting lock screen & wallpaper background, playing win sound, and display message box

# Set lock screen image
$lockScreenImage = "${Env:VM_COMMON_DIR}\lockscreen.png"
if ((Test-Path $lockScreenImage)) {
New-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Force | Out-Null
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name LockScreenImagePath -PropertyType String -Value $lockScreenImage -Force | Out-Null
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP" -Name LockScreenImageStatus -PropertyType DWord -Value 1 -Force | Out-Null
}

# Set wallpaper
Set-ItemProperty 'HKCU:\Control Panel\Colors' -Name Background -Value "0 0 0" -Force | Out-Null
$backgroundImage = "${Env:VM_COMMON_DIR}\background.png"
if ((Test-Path $backgroundImage)) {
# Center: 0, Stretch: 2, Fit:6, Fill: 10, Span: 22
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value 0 -Force | Out-Null
$img = [System.Drawing.Image]::FromFile($backgroundImage);
$wallpaperStyle = if ($img.Width/$img.Height -ge 16/9) { 0 } else { 6 }
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $wallpaperStyle -Force | Out-Null
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 0 -Force | Out-Null
Add-Type -TypeDefinition @"
using System;
Expand Down

0 comments on commit 74f5d30

Please sign in to comment.