Archive for August, 2011

Querying BMC ADDM / Atrium from Powershell.

August 30th, 2011 No comments

We have a new discovery appliance at a client site – BMC atrium.

I was having a look at it and unfortunately it does not have a normal SQL backend . . so it is not as easy to collect information as I would like (well . . .it is if you do a little legwork)

Looking through the docs, I found they do have an API – and actually . . the API was incredibly simple to use – just need some web access.

Well. my weapon of choice is always PowerShell . . so all I need is a simple web query no?

there are a few tricks though.

I do not want to have to keep providing my password
I would not like any clear text passwords knocking about
I want to be able to pass Queries that contain special characters
I’d like a simply object returned that can easily be manipulated using normal PowerShell syntax.

Here’s what I came up with.

Note – you’ll need to specify a server and a proxy (or include these in your function by editing the values in the first line of the function

Remember – it would be best practice to create a read-only account and use these creds for queries.

Function get-Addm ([string]$query,$servername"myserver.lab.local", $username, $password, $proxy="myproxy.lab.local", [switch]$resetpwd)
	# Use system reflection to convert string to URL.
	[System.Reflection.Assembly]::LoadWithPartialName("System.Web") | out-null
	$query = [System.Web.HttpUtility]::UrlEncode($query)
	# Check for password / gather password info
	If ($resetpwd)
		{del $env:userprofile\$username.txt}
	If (!$username)
		write-host "No Username specified - using $env:username" -fore Green
		$username = $env:username
	if (test-path $env:userprofile\$username.txt)
		write-host "Stored creds found for $username" -fore Green
		write-host "No Password saved for $username - please specify a valid pwd" -fore Green
		read-host -assecurestring | convertfrom-securestring | out-file $env:userprofile\$username.txt
		$password = get-content $env:userprofile\$username.txt | convertto-securestring
		$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password

	# Decrypt stored creds 
	$pw =  $credentials.GetNetworkCredential().password
	# Create Web request
	$proxy = new-object System.Net.WebProxy $proxy
	# $proxy.credentials = $proxycred.GetNetworkCredential()
	$WebClient = New-Object System.Net.WebClient
	$webclient.proxy = $proxy 
	$url = "https://$servername/ui/api/CsvApi?query=$query&username=$username&password=$pw"
	$Webclient.DownloadFile($url, "$env:temp\tmp.csv")
		#Import captured CSV
	$csv = import-csv "$env:temp\tmp.csv"
	return $csv

So now I can simply generate a custom query in the GUI – then recycle this query for future searches, using Powershell – and get an opbject returned which I can edit as per normal Powershell queries.

so – for example, I’d like all windows servers and the DNS servers currently configured for these:

get-addm -query "SEARCH Host WHERE (os HAS SUBSTRING 'windows') SHOW name, os, vendor, virtual, partition, #InferredElement:Inference:Associate:DiscoveryAccess.endpoint, #DeviceWithInterface:DeviceInterface:InterfaceOfDevice:NetworkInterface.dns_servers AS 'DNS Servers'" -username "read_only" -servername "myappliance"

Categories: ADDM, Powershell Tags:

Removing hidden devices after a P2V

August 30th, 2011 No comments

After  P2Vs, you are often (in fact almost always) left with hidden devices in computer management – which relate to old hardware that no longer lives with your machine.


Getting rid of this is advised – to keep yourmachine as tidy as possible, and will also eliminte some of the error message often seen when re-using IPs for NICs that previously existed on your Server.


Simple to do:

Open a command prompt your Windows VM (Start –> Run –> cmd).
set devmgr_show_nonpresent_devices=1
Open device manager:
In the device management console (View –> Show Hidden Devices).
Now simply r0ght-click each of these ‘hidden’ devices and select uninstall.
You’ll probably get prompted to reboot.
job done
Categories: VMWare Tags:

Licensing part 2

August 4th, 2011 No comments

So, we all saw the massive impact of the initial vSphere 5 announcement – all that anyone cared about is licensing. have a look at the VMCommunity and you’ll see thousands of posts complaining about it.

Well VMware – being the company they are, have listened to their customers and come up with a far neater, and more lenient licensing model.

The big changes:
Increased vRAM entitlements for all vSphere editions, including the doubling of the entitlements for vSphere Enterprise and Enterprise Plus.
Capped the amount of vRAM we count in any given VM, so that no VM, not even the “monster” 1TB vRAM VM, would cost more than one vSphere Enterprise Plus license.
An adjusted our model to be much more flexible around transient workloads and short-term spikes that are typical in environments such as test & dev.

Here is a comparison of the licensing entitlements:

vSphere edition Previous vRAM entitlement New vRAM entitlement
vSphere Enterprise+ 48 GB 96 GB
vSphere Enterprise 32 GB 64GB
vSphere Standard 24 GB 32 GB
vSphere Essentials+ 24 GB 32 GB
vSphere Essentials 24 GB 32 GB
Free vSphere Hypervisor 8 GB 32 GB²

To be honest – these are huge changes – I am almost astonished that the Free Hypervisor goes up to 32GB, and am hugely impressed by the allocated entitlements on other licensing versions.

For more info o nthe updates see :

To get an idea of how your will be impacted by the licensing – VMware have created a Powercli script – available here:

Al Renouf over at has written a very easy to use PowerCli script that’ll generate a nice pretty html report to show you how you will be affected.

Running a report, using the revised model has taken me from being 80% of the way through my entitlement (serious Oh $h!t moment – seeing as we are adding another 30% to our environment in upcoming months), to a very realistic 41% – therefore totally nullifying the impact of the license upgrade for me.

So here I stand:

Pooled vRam Capacity: 24576 GB
Number of VMs Powered On: 1623
Current vRam usage: 10065 GB
Percent vRam usage: 41%
Number of VMs if all were Powered on: 1692
vRam usage if all VMs were Powered on: 10525 GB
Percent vRam usage if all VMs were Powered on: 43%

Happy days . . .


Categories: VMWare Tags: