Skip to content

Instantly share code, notes, and snippets.

# This script is from MSDN
Install-WindowsFeatures Containers
#Download docker service and client
Invoke-WebRequest "https://get.docker.com/builds/Windows/x86_64/docker-1.12.1.zip" -OutFile "$env:TEMP\docker-1.12.1.zip" -UseBasicParsing
# Put docker to \Program Files\docker
Expand-Archive -Path "$env:TEMP\docker-1.12.1.zip" -DestinationPath $env:ProgramFiles
$sw = [Diagnostics.Stopwatch]::StartNew()
Import-Module -Name C:\temp\NanoServer\NanoServerImageGenerator
# Prepare password as secure string
$secAdminPassword = ("Passw0rd"|ConvertTo-SecureString -AsPlainText -Force)
# Create Nano image
New-NanoServerImage -MediaPath C:\temp -BasePath .\ -DeploymentType Guest -Edition Standard -TargetPath "c:\temp\NanoVM\vmNanoStorage.vhdx" -AdministratorPassword $secAdminPassword -MaxSize 10GB -storage -ComputerName Nano
# Create VM
$strVM = "Nano"
New-VM -VHDPath c:\temp\nanovm\vmnanostorage.vhdx -MemoryStartupBytes 512MB -Name $strVM -Generation 2
@ChabaOk
ChabaOk / addtrustedhost.ps1
Last active December 23, 2016 10:39
Add winrm trusted host
Start-Service WinRM
$myTrustWinRM = get-Item WSMan:\localhost\Client\TrustedHosts
if($myTrustWinRM.Value.Length -eq 0)
{
$myNewTrust = "192.168.1.113"
Write-Host "new trustedhosts"
}
else
@ChabaOk
ChabaOk / set-spooler.ps1
Created April 9, 2017 09:12
Simple set spooler service in PowerShell DSC
Configuration ManagePrintServer
{
param (
[string[]]$NodeName = 'localhost'
)
Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
Node $NodeName
{
Service StartSpooler
@ChabaOk
ChabaOk / Check-Package.ps1
Created April 20, 2017 17:48
Demonstrate Powershell DSC for Notepad++ installation
configuration PackageTest{
param(
[Parameter(Mandatory)] $Machine
)
Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
node $Machine
{
Package PackageExample
configuration PackageTest{
param(
[Parameter(Mandatory)] $Machine
)
Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
node $Machine
{
Package PackageExample
$MyCert = new-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\my `
-DnsName api.vm360degee.com `
-friendlyname api.vm360degree.com `
-NotAfter ( [DateTime]::Now.AddYears(5)) `
-KeyAlgorithm RSA `
-KeyLength 2048 `
-KeySpec Signature `
-Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" `
-KeyExportPolicy Exportable `
-KeyUsage DigitalSignature `