The greatest challenge to any thinker is stating the problem in a way that will allow a solution

Bertrand Russell

Welcome to vBlog, a personal record of my techy tinkerings and particular ponderings.

I tend to focus on VMware virtualisation, and the interaction/automation of it using PowerCLI (VMware's PowerShell Snapin), but anything that I happen to stumble across that seems like it might be of use at a later date, may well get recorded here.

I also maintain vWiki, which was a predecessor to this blog. Wiki's are great for quickly recording snippets of info, but tend not to look that great; Blog's are better looking things, but seem to require more effort so that the posts/articles are accessible in their own right. As a result I tend to update both interchangeably as available time, and depth of thought, permit.

If you happen to find anything of use, or in need of correction please leave a comment. Knowing that my ramblings are of some use is a great reward; and similarly I'd hate to waste anybody's time by feeding them duff info.

See these pages for me info about me, and my vBlog, and below for my recent posts...

17 Sep 2013

PowerShell

1 comment

Trying to compare the members of Windows domain Security or Distribution groups cans be a bit of a pain, especially when you’ve got nested groups. To make life a bit easier I wrote a quick script that will go through the members of the groups you want, including unlimited sub-groups (see note below). The script creates a nice grid output table, which you can sort/filter etc. Continue reading →

The logs that the Windows DHCP Server creates for client IP requests are only retained for a week. Which is a bit of a problem if you’re trying to investigate some activity on the network that occurred over 7 days ago. You can retain the logs for longer but you need to archive them off yourself.

The script below archives all available logs to a place of your choosing, and can optionally archive IP v6 logs as well. Continue reading →

28 Jun 2013

PowerShell

3 comments

It is, from time to time, useful to be able to see what is being printed via your print server.  Be it to identify busy printers, heavy users, or in order to keep an eye on what kind of documents are being printed.

This is relatively easy to achieve, but you do need to enable the appropriate logging on your server, as the info isn’t recorded by default.  To display the information in a easy to digest format, requires a few lines of PowerShell as well. Continue reading →

This script utilises a free 3rd party .NET library in order to be able to run SNMP queries from within PowerShell.  I created it in order to be able to keep track of the creation and usage of DHCP scopes during a migration project, and meant that I could instantly find out how short or not we were of available IP addresses.  Longer term you’d obviously want to set-up proper monitoring.

For more info on setting up the SNMP .NET library see my vWiki page – http://vwiki.co.uk/SNMP_and_PowerShell.  Its quite simple.  You have to download the binary package, extract and find the SharpSnmpLib.dll file, then load that into your PowerShell session and hey presto – you have SNMP functionality in PowerShell! Continue reading →

This post provides an example of how to gather some basic system info from an SNMP enabled host using PowerShell.

Why wouldn’t I use WMI?

You could in many circumstances.  In general the amount of information you can get from WMI is far greater than what’s available via SNMP, however,

  • In order to access WMI you often end up requiring full admin rights on the target systems, which is a security nightmare.
  • WMI is Windows platform dependant, whereas SNMP is normally available for any enterprise device.

Continue reading →

I wasn’t particularly waiting for the latest version of PowerShell to arrive.  Version 2 was doing me just fine, however by luck I happened to be playing with a .NET library that required .NET v4.  .NET 4 isn’t officially supported by PowerShell 2, you can force it, but it comes with a few caveats and cautions.  However, PowerShell 3 does support .NET 4, which meant all I had to do was upgrade PowerShell.

In my very limited time using PowerShell v3 there’s one thing that stands out: the Integrated Scripting Environment (ISE) has been vastly improved… Continue reading →

A while back I discovered a SNMP .NET offering that (given that PowerShell is .NET) meant that I could use PowerShell as a SNMP client, which I’ve documented on my Wiki – http://vwiki.co.uk/SNMP_and_PowerShell.

At the time my intended aim for the ability disappeared, and so I never really got to put into use.  This post brings together a couple of techniques in order to achieve regular SNMP polling of a device.  The results of which go into an RRD database (you don’t need to do this, what you do with the results of the SNMP polls is up to you). Continue reading →

I manage a number of Vyatta routers, for which the config changes irregularly.  And whilst I do keep an offline copy of their configs, I do this in a manual fashion, which means its not done reliably, which means its not a reliable backup solution.

Hence I crafted a simple PowerShell script which takes a backup of the routers config if its changed since the last backup… Continue reading →

28 Mar 2012

PowerShell

5 comments

Catchy title, eh?

I make quite extensive use of the NAT’ing functionality of Vyatta routers, and it can be quite a pain in the task to keep track of servers’ real (local) and NAT’ed (remote) IP addresses.

Therefore I have the need to collate all the address translations into a central report, in an easy (aka scripted) fashion.  There are probably other ways of achieving this, but for me its a PowerShell script that SSH’s to each Vyatta router in order to query it… Continue reading →

Upgrading VMTools always seems like such an afterthought.  You get through the effort of upgrading your vCentre, and ESX’s without any service interruption, then are left with a load of VM’s with out-of-date Tools and little authority to take them down as part of the upgrade.  Plus if you’re faced with the drudgery of having to speak to all sorts of different people and departments, its the kind of task that is only ever on the back-burner.

I tend to try to upgrade machines during ad-hoc reboots, which isn’t always sensible (during an service incident for example), and requires you to remember (not always possible if you’ve been up most of the night due to young kids / over exuberant drinkage).

There is an often overlooked option that lets you automatically update VM’s during a bounce, the only problem is – how to set on all your VM’s and retain full use of your mouse wielding arm and eyes…? Continue reading →