So I am no scripting master, my PowerShell knowledge is still something I want to expand. During an install last week I had a number of hosts to setup from scratch, so I decided to do this via PowerCLI, as a lot of the tasks were repetitive. Setting up the vSwitch networking and iSCSI configuration for each host
For those of you new to scripting, I’ve included screenshots to accompany the commands so you can see whats going on in the GUI.
Note: the full code without the breaks is at the end of this post
#Setup which host to target
$VMhost = 'hostname'
Continue reading PowerCLI – Setup Host networking and storage ready for ISCSI LUNs
So basically I had a host failure where all of the configure was lost, if I was more savvy with Powershell/PowerCLI, I would have been able to rebuild it all via scripts, but that clones the settings from a working host.
But nevermind that is for a different day of learning.
So I configured the host to the point of Networking, so the vSwitches had the correct NICs, but I needed to do all the port groups, which in the GUI if you have a few to do is time consuming.
So in PowereCLI, pull all of your information, port-group names and VLAN IDs.
Get-Vmhost -name <FQDN of host> | Get-VirtualSwitch -name | Get-VirtualPortGroup
To create a port-group
Get-Vmhost -name <FQDN of host> | Get-VirtualSwitch -Name | New-VirtualPortgroup -Name "Name of PG" -VlanID
Obviously this is a very short crude method of achieving what I need, but here you can see the basic building blocks needed to create Port Group in PowerCLI.
Coding, Scripting, Powershelling, etc etc, Dirty words in the mouth of Infrastructure guys across the globe.
When I was in college taking on my computer course, I had two options, Hardware and Networking, or Web Design. I went with my interests and skillsets, hardware and networking.
Coding to me is something I wasn’t interesting in when I became a geek, I wanted to provide the platforms for you to build and run your apps on, not be the guy building the apps. It looks like I screwed up, Job Security wise and Pay wise.
5 Years ago when I was getting into the IT industry, it was taking a number of days to provision a server ready for application installation and deployment. Now, thanks to virtualisation, this has been reduced to minutes. Something I think I’ll blog about on another day, the changes in the industry as I see it.
Here’s two slides showing this, provided by Joe Baguley (CTO, VMware).
Continue reading Get-PowerShelling or Remove-JobRole