Skip to content

Instantly share code, notes, and snippets.

@bundyfx
Created February 24, 2016 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bundyfx/c85e08f0b221a88d0c55 to your computer and use it in GitHub Desktop.
Save bundyfx/c85e08f0b221a88d0c55 to your computer and use it in GitHub Desktop.
break
#0o0o0o0o0 git content
$ContentPaths = 'C:\Lab\Git\Prod','C:\Lab\Git\Test','C:\Lab\Git\Dev'
git clone https://github.com/bundyfx/Example-Web.git $ContentPaths[0] --quiet
git clone https://github.com/bundyfx/Web-Example-Test.git $ContentPaths[1] --quiet
git clone https://github.com/bundyfx/Web-Example-Dev.git $ContentPaths[2] --quiet
ii C:\Lab\Git
#We can pre-load our servers with any sort of configuration/files etc
1..(Get-Childitem C:\Lab\*.vhdx).count | % {
Mount-DiskImage -ImagePath "C:\Lab\Nano$_.vhdx"
Copy-Item ($ContentPaths[1 - $_] + "\Index.htm") -Destination E:\inetpub\wwwroot\index.htm
Dismount-DiskImage -ImagePath "C:\Lab\Nano$_.vhdx"
}
#lets make a new VM
$Path = (gci C:\Lab\*.vhdx).FullName
$Names = ($Path | sls 'Nano\d{1}' -AllMatches).Matches.Value
# 250MB is more than enough memory for a VM
$Names | % { New-VM -MemoryStartupBytes (250mb) -Name $_ -VHDPath C:\Lab\$_.vhdx -Generation 2 -SwitchName (Get-VMSwitch).Name}
#start those VM up
Start-VM (Get-VM $Names | ? State -eq 'Off') -Passthru
#flick back to DC1 and bring up websites
#demo shutdown start up time \ check website
Get-VM $Names | Stop-VM
Get-VM $Names | Start-VM
#Show Recovery Console
$secpasswd = ConvertTo-SecureString "EpicPassword1" -AsPlainText -Force
[Array]$Creds += $Names | % { New-Object System.Management.Automation.PSCredential ("$_\Administrator", $secpasswd)}
Enter-PSSession -VMName Nano2 -Credential $Creds[1]
Set-DnsClientServerAddress -Interfacealias Ethernet -ServerAddress '192.168.0.1' #or whatever our DNS is currently
tnc
Find-PackageProvider
Find-Package -providername nuget -source http://www.nuget.org/api/v2
install-package node.js -destination C:\node -providername nuget -source http://www.nuget.org/api/v2
cd C:\node\node.js.5.3.0
'console.log("Hello from node.js running on Nano server!!");' | Out-File -encoding ascii hello.js
.\node.exe hello.js
### Let's talk about Windows Containers, Yes this is Docker built into Windows Server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment