Skip to content

Instantly share code, notes, and snippets.

@PatOShea
Last active August 29, 2015 14:25
Show Gist options
  • Save PatOShea/5f689fd892552bac4e9b to your computer and use it in GitHub Desktop.
Save PatOShea/5f689fd892552bac4e9b to your computer and use it in GitHub Desktop.
Build Nano Server
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