Tag Archives: PowerCLI

PowerCLI – Import-VApp Name or service not known

I kept running into the error whilst running PowerCLI on Ubuntu. After wracking my brains, I realised that the issue is DNS, my Ubuntu box couldn’t resolve the FQDN for the ESXi host, which is a mandatory parameter for the Import-vApp command.

Import-VApp             Name or service not known

Import-VApp Name or service not known

Dean

PowerCLI with a GUI – Clone a machine, add DHCP Reservations, alter CPUID

In this blog post, I am going to break down a PowerShell code I have created (with help from some colleagues). The functions of this PowerShell code are;

  • Present a GUI form to the end user
    • Connect to a vCenter
    • Select the virtual machine to be cloned
    • Select the datastore the new VM is to be stored on (display DS free space)
    • Select the host for this VM to be created against (display free memory on the host)
    • Set the new VM name
    • Create an IP reservation in both the Production and DR DHCP Scopes

Below are some functional screenshots of the code’s GUI and also a rough flowchart of what I needed to achieve.

You can skip to the end to find the full code.

A little more background on the script

Continue reading PowerCLI with a GUI – Clone a machine, add DHCP Reservations, alter CPUID

PowerCLI – Setup Host networking and storage ready for ISCSI LUNs

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

Using PowerCLI to create Virtual Machine Port Groups

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

2014-11-12_00-07-01

To create a port-group

Get-Vmhost -name <FQDN of host> | Get-VirtualSwitch -Name  | New-VirtualPortgroup -Name "Name of PG" -VlanID
2014-11-13_10-58-47

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.
Regards

Dean


Get-PowerShelling or Remove-JobRole

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.

spongebob-school

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).

Slide1 Slide2

Continue reading Get-PowerShelling or Remove-JobRole