Giter Club home page Giter Club logo

winvm's Introduction

WinVM

Windows Desktop VM Initial Setup

Tested on Azure windows 10 and windows 11 images

# install choco
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# install WSL2
start cmd "/c wsl --install"

# reload environment
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

# create directory for the powershell profile
start cmd "/c mkdir %USERPROFILE%\Documents\PowerShell"

choco install -y wget 
choco install -y git --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" --install-arguments="'/DIR=C:\swtools\git'"

# reload environment
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

mkdir \dev
cd \dev
git clone https://github.com/yanivharpaz/WinVM.git

# download font and theme to the desktop
cd $env:USERPROFILE\Desktop

copy -Force c:\dev\WinVM\setup_files\DelugiaCodeNerdFontComplete.ttf .\
copy -Force c:\dev\WinVM\setup_files\yaniv_dark_01.deskthemepack .\

mkdir config
cd config

copy -Force c:\dev\WinVM\setup_files\*.* .\
copy -Force c:\dev\WinVM\scripts\*.* .\

choco install -y googlechrome

copy -Force "Microsoft.PowerShell_profile.ps1" $env:USERPROFILE\Documents\PowerShell



VM creation script example // Windows 10

export NEW_DNS_NAME="tmpVM01"

export NEW_LOCATION="eastus2"
export NEW_RG="rg-home-us2"
export NEW_NSG="nsg-home"

export NEW_SIZE="Standard_D8s_v3"
export NEW_IMAGE="MicrosoftWindowsDesktop:Windows-10:21h1-entn:latest"

export NEW_VM="vm-win-"$NEW_DNS_NAME
export NEW_KV="kv-"$NEW_VM

export NEW_VNET="vnet-home"
export NEW_SUBNET="sub-a"

az vm create \
    --name $NEW_VM  \
    --resource-group $NEW_RG \
    --location $NEW_LOCATION \
    --size $NEW_SIZE  \
    --image $NEW_IMAGE \
    --subnet $NEW_SUBNET \
    --nsg $NEW_NSG \
    --vnet-name $NEW_VNET \
    --public-ip-address-dns-name $NEW_DNS_NAME \
    --public-ip-sku Standard \
    --storage-sku StandardSSD_LRS  \
    --tags 'dept=home' 'project=personal' server=$NEW_VM  \
    --os-disk-size-gb 256 \
    --admin-username "adminXXXX" \
    --admin-password "YYYYYYY" 



setting up a basic network for a region


export NEW_LOCATION="westeurope"
export NEW_RG="rg-test-westeurope"
export NEW_NSG="nsg-home"
export CIDR_PREFIX="10.7"

export NEW_VNET="vnet-home"
export NEW_SUBNET="sub-a"

export NEW_HOME_IP="xxx.xxx.xxx.xxx"

# resource group
az group create -n $NEW_RG --location $NEW_LOCATION

# network security group

az network nsg create --location $NEW_LOCATION --name $NEW_NSG --resource-group $NEW_RG

az network vnet create -g $NEW_RG -n $NEW_VNET --address-prefix $CIDR_PREFIX.0.0/16 \
    --subnet-name default-a --subnet-prefix $CIDR_PREFIX.0.0/24
	
az network nsg rule create -g $NEW_RG --nsg-name $NEW_NSG -n rdp_ssh --priority 172 \
    --source-address-prefixes $NEW_HOME_IP/31 --source-port-ranges '*' \
    --destination-address-prefixes '*' --destination-port-ranges 22 3389 --access Allow \
    --protocol '*' --description "Allow home access."	

az network vnet subnet create -g $NEW_RG --vnet-name $NEW_VNET -n sub-a \
    --address-prefixes $CIDR_PREFIX.1.0/24 --network-security-group nsg-home
az network vnet subnet create -g $NEW_RG --vnet-name $NEW_VNET -n sub-b \
    --address-prefixes $CIDR_PREFIX.2.0/24 --network-security-group nsg-home
az network vnet subnet create -g $NEW_RG --vnet-name $NEW_VNET -n sub-c \
    --address-prefixes $CIDR_PREFIX.3.0/24 --network-security-group nsg-home



winvm's People

Contributors

yanivharpaz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.