Waclaw Chrabaszcz
... there is no spoon ...

SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Friday, June 28, 2013 8:27 AM

Have you ever seen "A Bridge too far" movie? To not to wake up a click too far, it is good to script some tasks. Yes of course we can follow wizards, but some of us want to be warriorsJ. A small tip, take a look on credentials and system GUID examples. I don't know how about you, but for me it will be really useful in the future.

 

 

# credents
$credential = Get-Credential
New-SCRunAsAccount -Name "TESTDOMAIN\Administrator" -Credential $credential

#storage
$opsMgrServerCredential = Get-SCRunAsAccount -Name "TESTDOMAIN\Administrator"
New-SCStorageClassification -Name "Bronze" -Description "" –RunAsynchronously
New-SCStorageClassification -Name "Silver" -Description "" –RunAsynchronously
New-SCStorageClassification -Name "Gold" -Description "" –RunAsynchronously

# add a shared storage
Find-SCComputer -ComputerName "dc.TESTDOMAIN.net"
Add-SCStorageProvider -AddWindowsNativeWmiProvider -Name "dc.TESTDOMAIN.net" -RunAsAccount $opsMgrServerCredential -ComputerName "dc.TESTDOMAIN.net"
$fileServer = Get-SCStorageFileServer "dc.TESTDOMAIN.net"
$fileShares = @()
$fileShares += Get-SCStorageFileShare -Name "VMMLibrary"
Set-SCStorageFileServer -StorageFileServer $fileServer -AddStorageFileShareToManagement $fileShares –RunAsynchronously

#fabric network
$logicalNetwork = New-SCLogicalNetwork -Name "TESTDOMAIN-Service-Network" -LogicalNetworkDefinitionIsolation $false -EnableNetworkVirtualization $true -UseGRE $true -IsPVLAN $false
$allHostGroups = @()
$allHostGroups += Get-SCVMHostGroup -Name "All Hosts"
$allSubnetVlan = @()
$allSubnetVlan += New-SCSubnetVLan -Subnet "10.0.0.0/24" -VLanID 0
New-SCLogicalNetworkDefinition -Name "TESTDOMAIN-Service-Network_0" -LogicalNetwork $logicalNetwork -VMHostGroup $allHostGroups -SubnetVLan $allSubnetVlan

#IP pool
$logicalNetwork = Get-SCLogicalNetwork -Name "TESTDOMAIN-Service-Network"
$logicalNetworkDefinition = Get-SCLogicalNetworkDefinition -LogicalNetwork $logicalNetwork -Name "TESTDOMAIN-Service-Network_0"

# Gateways
$allGateways = @()
$allGateways += New-SCDefaultGateway -IPAddress "10.0.0.1" –Automatic
# DNS servers
$allDnsServer = @("10.0.0.1")
# DNS suffixes
$allDnsSuffixes = @("TESTDOMAIN.net")
# WINS servers
$allWinsServers = @()
New-SCStaticIPAddressPool -Name "TESTDOMAIN-Service-Network" -LogicalNetworkDefinition $logicalNetworkDefinition -Subnet "10.0.0.0/24" -IPAddressRangeStart "10.0.0.51" -IPAddressRangeEnd "10.0.0.75" -DefaultGateway $allGateways -DNSServer $allDnsServer -DNSSuffix "" -DNSSearchSuffix $allDnsSuffixes –RunAsynchronously

#Hyper-V Virtual Networks
$logicalNetwork = Get-SCLogicalNetwork -Name "TESTDOMAIN-Service-Network"
$vmNetwork = New-SCVMNetwork -Name "TESTDOMAIN-VMN" -LogicalNetwork $logicalNetwork -IsolationType "WindowsNetworkVirtualization" -CAIPAddressPoolType "IPV4" -PAIPAddressPoolType "IPV4"
Write-Output $vmNetwork
$subnet = New-SCSubnetVLan -Subnet "10.0.0.0/24"
New-SCVMSubnet -Name "Con-SN" -VMNetwork $vmNetwork -SubnetVLan $subnet

# bind VLAN with the Network Adapter
$vmHost = Get-SCVMHost -ComputerName "VMM01.TESTDOMAIN.net"
$vmHostNetworkAdapter = Get-SCVMHostNetworkAdapter -VMHost $vmHost #-Name "Intel 21140-Based PCI Fast Ethernet Adapter (Emulated)"
Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -Description "" -AvailableForPlacement $true -UsedForManagement $true
$logicalNetwork = Get-SCLogicalNetwork -Name "TESTDOMAIN-Service-Network"
Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -AddOrSetLogicalNetwork $logicalNetwork
Set-SCVMHost -VMHost $vmHost -RunAsynchronously -NumaSpanningEnabled $true

#Create a Private Cloud
$Guid = [System.Guid]::NewGuid()
Set-SCCloudCapacity -JobGroup $Guid -UseCustomQuotaCountMaximum $false -UseMemoryMBMaximum $false -UseCPUCountMaximum $false -UseStorageGBMaximum $false -UseVMCountMaximum $false -CustomQuotaCount 10 -MemoryMB 10240 -CPUCount 10 -StorageGB 386 -VMCount 10
$resources = @()
$resources += Get-SCLogicalNetwork -Name "TESTDOMAIN-Service-Network"
$resources += Get-SCLoadBalancer -Manufacturer "Microsoft"
$readonlyLibraryShares = @()
$readonlyLibraryShares += Get-SCLibraryShare | where { $_.LibraryServer.Name -eq "dc.TESTDOMAIN.net" -and $_.Name -eq "VMMLibrary" }
$addCapabilityProfiles = @()
$addCapabilityProfiles += Get-SCCapabilityProfile -Name "Hyper-V"
$Guid2 = [System.Guid]::NewGuid()
Set-SCCloud -JobGroup $Guid2 -RunAsynchronously -AddCloudResource $resources -AddReadOnlyLibraryShare $readonlyLibraryShares -AddCapabilityProfile $addCapabilityProfiles
$hostGroups = @()
$hostGroups += Get-SCVMHostGroup -Name "TESTDOMAIN"
New-SCCloud -VMHostGroup $hostGroups -Name "TESTDOMAIN-Cloud" -Description "" –RunAsynchronously




Feedback

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having

all the enjoyment here keep up the good work, anine bing 9/22/2014 5:36 AM | sivarama

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

I was just wondering do you trade featured blog posts. Thanks for sharing your Blog with others. You really share Click Here valuable information. 4/2/2015 10:55 AM | Jerry Shaw

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

I don't know how about you, but for me it will be really useful in the future of using of power shell.

Regards,
How to No No 8/1/2015 10:01 AM | Tomi Hank

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

hey guys, from here you can easily grab amazon gift card code generator online totally free of cost. 3/26/2016 8:22 AM | Neelam

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

It seems that need to hire a professional developers to understand and integrate this code as I'm not well known with power shell usage, If there is any one here do pm me please. Thanks!

Jackob 4/1/2016 12:25 PM | Jakob

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

You’ve written nice post, I am gonna bookmark this page, thanks for info. I actually appreciate your own position and I will be sure to come back here.
happy wheels 4/12/2016 4:22 AM | happy wheels

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

When you will take a look at the next package of scripts which will be focused on operational aspects of a cloud – on-boarding virtual machines, moving and monitoring them.

By - theroom graphic and web design Brisbane.

4/25/2016 7:10 AM | Jasmine

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

You have made some wonderful points right here which are thought provoking and intriguing. I am happy I came across this informative article.

ppm-factory 6/7/2016 9:05 AM | Jackob

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

I like the article so much because it is very relevent to the today's scenario. I hope this will result a positive future. Thanks 6/17/2016 7:44 AM | Legal Steroids UK

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

It will take you to the next level of scripts which will be focused on every aspects of this. Thanks for writing such nice article.
Regards
6/17/2016 7:56 AM | cara

# coc cheats

You have not to worry any more as there is the place where you would get the coc cheats where you will get unlimited gems,gold,elixirs and many others through which you will cross all the levels of it much easily and you will be fully entertained.Clash of clans is the best game which every one should play for the enjoyment. 6/18/2016 12:30 PM | sam

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

You’ve written nice post, I am gonna bookmark this page, thanks for info. I actually appreciate your own position and I will be sure to come back here.
roblox games 8/25/2016 12:11 PM | roblox

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Could system is getting popular now days., Thanks for helping us to know how to create a Private Cloud using PowerShell. Most companies prefer changing to cloud systems. directv thanks for sharing the same. 12/2/2016 12:48 PM | tammy philip

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Wow. cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though.
super smash flash 2
12/26/2016 2:34 PM | MarkCPhillips

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

This is such a great resource that you are providing and you give it away for free. I love
seeing that understand the value of providing a quality resource for free. :) :)
bloons tower defense 5
12/26/2016 2:35 PM | karkCPhillips

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Your blog posts are more interesting and impressive. I think there are many people like and visit it regularly, including me.I actually appreciate your own position and I will be sure to come back here hotmail account login 5/4/2017 7:43 AM | Kidz Kul

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

I would like to say that this blog really convinced me to do it! Thanks, very good post hotmail email login 5/4/2017 7:43 AM | Ron91 Ron91 Ron91

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

I have found the post very useful and informative. Thank you for sharing this one.I will continually be coming on a regular basis you just read your posts.
Obat Penghilang Kista Coklat,
Obat Tradisional Penambah Trombosit 5/16/2017 10:02 AM | ratna9635

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Fantastic post on scvmm round 2 to create a prive log for users.

Teno 7/26/2017 11:10 AM | Teno

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Fantastic post on scvmm round 2 to create a prive log for users.

Teno 7/26/2017 11:12 AM | <a href="http://tenoblog/">Teno<

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

why dont you visit this amazing site walatrashop 1/10/2018 8:48 AM | wawan

# re: SCVMM – Round 2 – How to create a Private Cloud using PowerShell

Great content. Here is a nice solution to your big pdf file. A nice compressor for free.
check out Soda Pdf compressor. 5/11/2018 12:51 AM | Rustic

Post a comment