Skip to content

Commit

Permalink
installer.vm: Add custom layout for taskbar pinning.
Browse files Browse the repository at this point in the history
  • Loading branch information
emtuls committed Nov 21, 2023
1 parent 2132656 commit a021188
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 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.20231020</version>
<version>0.0.0.20231120</version>
<authors>Mandiant</authors>
<description>Generic installer for custom virtual machines.</description>
<dependencies>
Expand Down
18 changes: 17 additions & 1 deletion packages/installer.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ try {
}
VM-Write-Log "INFO" "Packages installation complete"

# Create an Admin Command Prompt shortcut to pin to taskbar
$toolName = 'Admin Command Prompt'
$category = 'Utilities'
$toolDir = Join-Path ${Env:TOOL_LIST_DIR}

$executablePath = Join-Path ${Env:SystemRoot} 'system32\cmd.exe'
$shortcutDir = Join-Path $toolDir $category -Resolve
$shortcut = Join-Path $shortcutDir "$toolName.lnk"

Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $executablePath -RunAsAdmin
VM-Assert-Path $shortcut

## Configure taskbar with custom Start Layout
$customLayout = Join-Path ${Env:USERPROFILE} 'Desktop\CustomStartLayout.xml'
Import-StartLayout -LayoutPath $customLayout -MountPath "C:\"
Stop-Process -Name explorer -Force # This restarts the explorer process so that the new taskbar is displayed.

# Set Profile/Version specific configurations
VM-Write-Log "INFO" "Beginning Windows OS VM profile configuration changes"
$configPath = Join-Path $Env:VM_COMMON_DIR "config.xml" -Resolve
Expand Down Expand Up @@ -226,4 +243,3 @@ Thank you!
} catch {
VM-Write-Log-Exception $_
}

0 comments on commit a021188

Please sign in to comment.