Tag Archives: PowerCLI

vSphere permissions: export & import – Part 2

In Part1 of this article we had all the roles and permissions exported to an XML file. It’s now time to import the roles and permissions into a Virtual Center.

The script does in fact the reverse of what the script in Part 1 did.

But there were a few “gotchas“ that had to be solved before arriving at a working solution.

Duplicate Names

The script does not take into account that you can have different objects in your vSphere environment with the same name! Which imho is not a good practice in any case.

Should someone have the need for this functionality let me know and I will try to adapt the scripts.

Principals

The script does not create the principals that are mentioned in the XML file. If these principals do not exists in the environment where you want to import the roles and permissions the script will show errors.

Speed of execution

The permissions are set with an API called SetEntityPermissions.

As can be seen in the API Reference Guide this method requires a Managed Object Reference (MoRef) to a ManagedEntity. A ManagedEntity object is the parent object of most of the managed objects in vSphere.

This way of working avoids that there would have to be a separate method for each of the derived managed objects.

Continue reading

VES: Advanced Reporting

Did you make the first Unofficial Online VMware User Group, well you sure missed a few things then, make sure you catch the video and sign up for the next one’s here

In the UOVMUG we were given an exclusive from Scott Herold of Quest who was giving a demo on the Virtualisation EcoShell, he showed us how you could produce highly customised great looking reports straight from the product, an enhanced version of vReport which is already available in the product.

He released this the next day on thevesi.org as an Action which can be downloaded and added to the existing version of the VES.

For step-by-step instructions on how to install this check out the article on the VES blog, for a preview of one of what you can do with the reports see below. Continue reading

Storage VMotion – The PowerCLI way

Ok, we all know what Storage VMotion is…

Enable live migration of virtual machine disk files across storage arrays. VMware Storage VMotion lets you relocate virtual machine disk files between and across shared storage locations while maintaining continuous service availability and complete transaction integrity.

VMware also give us some nice detail telling us how Storage VMotion works…

Continue reading

PowerCLI on steroids – Custom attributes

PowerCLI is a great tool to manage your vSphere environment. No discussion about that!

The package contains cmdlets for, let’s say 80% of your vSphere day to day tasks, and for the missing 20% you can always fall back on the vSphere APIs (or ask in the PowerCLI community).

The only problem that pops up from time to time is the performance of some of the PowerCLI cmdlets.The Get-Vm cmdlet is one of these infamous cmdlets which, when executed in a decently sized (number of guests) vSphere environment, tends to be quite slow.

But as with the 80%-20% rule above, you can fall back on the vSphere APIs to speed things up a bit.
Add to that some medium to advanced PowerShell features and the time gains you can reach are impressive.

The problem at hand was that we needed a script to update a number of custom attributes on our guests.

A quick method of doing this would be something along these lines:

Get-VM | Set-CustomField -Name “MyField” -Value “new-value”

Continue reading

License Server Scripts

Duncan recently posted a nice license script which checks every ESX Host for the availability of the license source, in his post he challenged me to write a script which checked the state of the license server service and sent an email if it was not running.

How could I let this pass without an answer, so I finally found time, the below script will get the license server from the VI server and then check to see if the license server service is running, if its not it will drop you an email, the idea of this is to run it as a scheduled task.

Continue reading

PowerCLI – What’s new ?

image Unless you have been living in a cave in the middle of the woods with no internet access you will know that today VMware released the long awaited and the worst kept secret of all time, vSphere.

Along with vSphere comes alot of other lowercase v starting words including vCompute, vNetwork, vStorage and vPowerCLI, actually hold on, they seam to have forgotten the v with this one, PowerCLI it is!  PowerCLI is the new look all improved VI Toolkit.

(Personally I love the name – much better than VI Tookit. Nice one C-Dawg !)

So what’s new ?

Continue reading

Customisation: Lesson 4 – PortGroups

Lessons so far in this blog post series:

So, we now have our host added to virtual center, we have it syncing the time with our central time server, we have the firewall adjusted to meet our needs and we have some virtual switches created, our vmotion vswitch and portgroup created and associated with some nics.  Now what ?

PortGroups !

As this will obviously be different for each configuration I will show you a couple of ways of doing this.  If your not starting to guess the format of the cmndlets by now then there is no hope, turn back and start again from lesson 1, if you can already guess the cmdlets we will be using then please continue to Go and collect £200.

Continue reading

UKVMUG: PowerCLI Presentation/Class

Last week at the UK London VMware User Group they tried something different, in the UKVMUG forums there had been a few threads from people interested in learning more about the VI toolkit or as it is now known PowerCLI.

I was contacted by one of the UKVMUG leaders and asked if I would be interested in giving a presentation/class for an hour before the normal UKVMUG for those who were interested in learning… I jumped at the chance as love to pass on my experiences and show people the easy way to learn both PowerShell and PowerCLI as there are a few shortcuts and things I have learnt over the past 6 months.

Continue reading

Icomasoft: PowerCLI Reference Card

icomasoft PowerCLI I have just had an email from the guys at icomasoft letting me know they have released a PowerCLI Reference Card much like my reference card release earlier this year, this is in a real nice PDF format and has some powershell basics as well as the PowerCLI cmdlet references and examples.

 

This looks like a great sheet to download and keep with you for reference, its a 4 page doc which covers an awful lot of information.

Continue reading

Hal’s book hits Amazon

I have mentioned it a few times on my blog but now Hal’s excellent book ‘Managing VMware Infrastructure with Windows PowerShell TFM’ is available via Amazon so for all the UK/European readers it means we get better posting prices.

Read more:

Buy it here: