Archive for October, 2009
Veeam backup and Replication V4
Oct 31st
Ok, backups, the bain of my life, I remember in a previous role we had to split this job, each of us doing a one week rota on backups as they should be the kind of thing that you run and everything is fine, but did they ever work ? No.
Anyway enough about my hate of backups and tape library’s etc, time for the cool stuff that changed my mind !
Veeam are a company of “firsts”, there is nothing Ricky El-Qasem from Veeam likes telling you more than how Veeam have done something first and to be honest I couldn’t agree more, they do always seem to have the latest of technologies in their software, the first people to use the latest features or to make things easier.
Veeam backup and replication has always been a great product and with the latest version the have done it again, there are many “firsts” in there again, mostly to do with the way the backups and restores are performed by totally slashing the time using vSphere’s new “vStorage API’s” technology. More >
PowerCLI: vSphere License Export
Oct 30th
Seeing Luc’s recent blog post where he explains how to add a vCenter License using PowerCLI, I thought I would stick with the licensing theme and show you how to export your vSphere License keys and details to a csv file enabling you to keep them backed up in a safe place.
This script will only work with vSphere as in vSphere the license server was removed and licensing became a great deal easier, if you want the v3 version you can grab it from my previous post here.
The output can be seen below:
Script:
$filename = “C:\LicenseInformation.csv“
If ((Get-View ServiceInstance).Content.About.Version-ge “4.0.0“){
$ServiceInstance = Get-View ServiceInstance
$LicenseMan = Get-View $ServiceInstance.Content.LicenseManager
$vSphereLicInfo = @()
Foreach ($License in $LicenseMan.Licenses){
$Details = “” |Select Name, Key, Total, Used,Information
$Details.Name= $License.Name
$Details.Key= $License.LicenseKey
$Details.Total= $License.Total
$Details.Used= $License.Used
$Details.Information= $License.Labels |Select -expand Value
$vSphereLicInfo += $Details
}
$vSphereLicInfo |Select Name, Key, Total, Used,Information |Export-Csv -NoTypeInformation $filename
}
Else {
Write “Sorry V4 Only“
}
I have included this in my new VESI PowerPack, the version in the PowerPack will automatically work out if your VI is V3 or V4 and show the appropriate information.
VESI & PowerGUI PowerPack Management
Oct 29th
I have spoken about VESI and PowerGUI a few times on the blog now so you should know all about these FREE little gems, one thing that I like about them is the way you can create your own PowerPack.
A PowerPack is basically a collection of scripts and actions and cmdlets all bundled together in shiny wrapping paper and passed back into the GUI for you to harness the power of Powershell without even realising it.
As you can see from the PowerGUI site there is a PowerPack for almost everything you would like to manage and if there isn’t one there then you could either put one together yourself or leave a message on their site planting the idea in their brains. More >
PowerCLI: Listing Cluster Primary HA Nodes
Oct 28th
Following my recent post on Slot Sizes and pointing to Duncan’s great HA Deepdive article I came across a great script today on Hypervisor.fr, he has been creating some great PowerCLI scripts recently and also sent me some fantastic additions to my Daily Report, all of which will be added in the next version which is due out any day now.
Just to set the background I will steel a little of Duncan’s post but please make sure you read his full article and then re-read it until it is ingrained in your brain, this guy knows his stuff. Duncan’s post reads…
A VMware HA Cluster consists of nodes, primary and secondary nodes. Primary nodes hold cluster settings and all “node states” which are synchronized between primaries. Node states hold for instance resource usage information. In case that vCenter is not available the primary nodes will have a rough estimate of the resource occupation and can take this into account when a fail-over needs to occur. Secondary nodes send their state info to the primary nodes.
Nodes send a heartbeat to each other, which is the mechanism to detect possible outages. Primary nodes send heartbeats to primary nodes only. Secondary nodes send their heartbeats to primary nodes only. Nodes send out these heartbeats every second by default. However this is a changeable value: das.failuredetectioninterval. (Advanced Settings on your HA-Cluster)
The first 5 hosts that join the VMware HA cluster are automatically selected as primary nodes. All the others are automatically selected as secondary nodes. When you do a reconfigure for HA the primary nodes and secondary nodes are selected again, this is at random. The vCenter client does not show which host is a primary and which is not.
A question was raised on the PowerCLI communities before the days of vSphere asking if you could get the information with regards to which of the hosts were primary for each cluster, a suggestion was made by The PowerCLI master himself LucD to grab the information via a putty session and then present it back onto PowerCLI to use the data.
Now, with vSphere and the updated SDK it would seam that this information is available, so I have modified the script found on Hypervisor.fr to list each cluster and the primary nodes within these cluster as seen in the example below:
This can be achieved with a simple (well kinda) script which will check that the cluster has HA enabled and that the vCenter server is Version 4 (vSphere) and then present the results for each cluster:
If ((Get-View ServiceInstance).Content.About.Version-ge “4.0.0“){
Get-View -ViewType ClusterComputeResource |Where {$_.Configuration.DasConfig.Enabled-eq $true} | Select Name, @{N=“PrimaryHosts“;E={[string]::join(‘ & ‘,(($_.RetrieveDasAdvancedRuntimeInfo()).DasHostInfo.PrimaryHosts))}}
}
Else{
Write “Sorry this is only available to a V4 vCenter Host“
}
Or if the perl toolkit is your cuppa tea then check out this version from William Lam (Perl Ninja)
I have also added this to a VESI PowerPack which I am in the middle of creating and will publish soon, as you can see from the below:
PowerShell V2 – Your admin life just got easier again
Oct 27th
If you haven’t yet heard Powershell V2 has arrived for all Windows operating systems and is downloadable from here.
So should you download it ?
YES
Why ?
Far too many reasons than I can write on this blog post, but if you think about it, how good was PowerShell v1 and its the first version of the framework, now how good do you think v2 will be !
Add to this that V1 came with 129 cmdlets (built in commands) and now V2 comes with over 230 by default that’s a great deal more we can achieve out of the box.
There are also lots of new concepts like remoting and modules and lots of speed fixes and bug fixes from the previous version.
PowerCLI
So will it still work with PowerCLI ? As far as i know there are no issues with it working with PowerCLI, I have upgraded my home pc and laptop and have not hit any issues as yet, its just a case of downloading V2 which installs more like a hotfix and installing on the box where you currently have v1 installed, all upgrades fine and is hunky dorey!
Workstation & Server Audit Script V3
Oct 26th
One thing I wish I had was more time to re-visit my old scripts and re-write them as I often look at my old script and it sends a cold shiver down my spine as I now know a better way of doing things.
As I was away for the weekend and had no internet connection I took my old Audit Script with me, I had a few personal objectives that I wanted to achieve by re-writing this code and I was also asked by a friend who has started to adapt the code into other formats.
So, this is version 3 of the script, you can see how much I have learnt recently as V1 of this script was over 1000 lines, V2 of this script was 847 and now with the new improved code it is a miniscule 459 lines
My main objectives for this version of the script were:
- Apply my newly learnt PS Skills to optimise the code
- Use a HTML format that worked in all browsers
- Make the code easy to follow
- Make the code easy for other people to produce similar reports of other systems
When you see the code and use the output I hope you will agree I have achieved each of these. The code now works with all browsers I have tested and is very easily customisable.
Check out a screenshot of the output below: More >
PowerCLI: Mass VM Portgroup Change
Oct 19th
I was asked in my Script List if it was possible to change Multiple VMs to attach to a new PortGroup, this task is easy enough so long as you remember that every VM can have up to 4 virtual nics in VI3 and up to 10 in vSphere.
So to change all virtual machines we would do the following:
$OldNetwork = "PG1 192.168.0"
$NewNetwork = "PG2 10.1.1"
Get-VM |Get-NetworkAdapter |Where {$_.NetworkName -eq $OldNetwork } |Set-NetworkAdapter -NetworkName $NewNetwork -Confirm:$false
Or to change all of the VMs for a particular cluster we could use:
$Cluster = "Non-Production"
$OldNetwork = "PG1 192.168.0"
$NewNetwork = "PG2 10.1.1"
Get-Cluster $Cluster |Get-VM |Get-NetworkAdapter |Where {$_.NetworkName -eq $OldNetwork } |Set-NetworkAdapter -NetworkName $NewNetwork -Confirm:$false
Note: By default the Set-NetworkAdapter cmdlet would prompt you for each change it was going to make, this is overwritten by using the –Confirm:$false parameter.
The VESI 1.2 – Get it now
Oct 18th
People who read my blog know how much I like the Virtualisation EcoShell, I love the way it adds the power of PowerCLI back into the GUI to enable you to create customised GUI’s all of your own enhancing the true power of PowerShell and allowing people who do not know how to code in PowerCLI (yet) the chance to harness the power.
Version 1.2 of the VESI has now been released and it has some great new features:
More >
PowerCLI: Host Network Config
Oct 14th
Whilst on a recent engagement with a customer we were looking at best practices and trying to quickly see how each PortGroup was configured, did all hosts have the same nics assigned to the same vSwitches, were all Portgroups setup the same to use the correct active and standby adapters ?
Have you ever tried doing this from the GUI ? Believe me it will take about 10 minutes to manually copy the relevant information from each host and if you have multiple PortGroups and multiple vSwitches then you can see how long this will take to check against best practice !
I think you know what is coming….
This came up again when someone asked me how to achieve exactly the same thing so I bumped it up my list of scripts I need to write.
Check out the below PowerCLI script, it lists all the needed information to perform this best practice analysis as you can see from the example output:
PowerGUI 1.9.5 Released
Oct 13th
As the readers of this blog probably know I am a big fan of PowerGUI and the VESI, not just for the great GUI console that enables fantastic powershell goodness in the form of a nice user interface but also for the fully functional script editor.
The one thing that amazes me about these applications is that they are FREE, yes that’s right, FREE, not free for x number of days or free to use 50% of the features but 100% free.
Another thing that also amazes me is the amount of work they put into this free app, i mean most companies release the free apps and then no further work or support is added to them, have you ever had a problem with PowerGUI ? If you have then you will have no doubt raised it in the PowerGUI forum and had it answered in a day at the latest !
Add to this the fact that Quest actually listen to what the people who use this want and it amazes me constantly.
Take for example my situation, in the previous versions of PowerGUI there was no GUI support for write-progress (a nice cmdlet that gives you a progress bar style popup), sometimes I had to second guess my scripts and what they were doing unless i ran them in the main PowerShell window, and if I did that I would get the write-progress output so at the recent UK PowerShell user group I hounded both Dmitry and Darin from Quest and told them I wanted a GUI version of the write-progress output, now if they got fed up of the constant emails or if they are just nice chaps (I think the later) they added this to the latest build in both the console and the script editor, proving that they do indeed listen.
So, head over to the PowerGUI site and download version 1.9.5 and try out the latest and greatest PowerGUI with added Write-Progress.






