Last active
August 29, 2015 14:25
-
-
Save PatOShea/5f689fd892552bac4e9b to your computer and use it in GitHub Desktop.
Build Nano Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd c:\temp\ | |
. .\NanoServer.ps1 | |
cls | |
$pass = ConvertTo-SecureString -String 'vagrant' -AsPlainText -Force | |
$paramHash = @{ | |
MediaPath = '.\NanoServer' | |
BasePath = '.\NanoBase' | |
TargetPath = '.\NanoImages' | |
AdministratorPassword = $pass | |
ComputerName = 'ps-nano' | |
EnableIPDisplayOnBoot = $True | |
Storage = $True | |
GuestDrivers = $True | |
EnableRemoteManagementPort = $True | |
} | |
New-NanoServerImage @paramHash | |
$original = Join-Path -Path $paramHash.TargetPath -ChildPath "$(Split-path $paramhash.TargetPath -leaf).vhd" | |
$destination = (Join-path -path .\NanoImages -child "$($paramHash.ComputerName).vhd") | |
Copy -Path $original -Destination $destination | |
$newVMHash = @{ | |
Name = $paramHash.computername | |
Generation = 1 | |
MemoryStartupBytes = 256MB | |
SwitchName = "Work Network" | |
VHDPath = $Destination | |
} | |
New-VM @NewVMHash | Set-VM -DynamicMemory -MemoryMaximumBytes 512MB -Notes "Test Nano Server" | |
Start-VM ps-nano-web |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment