Tuesday, 7 April 2009

Recently I needed to check some registry key values on a bunch of servers. There were far too many servers to make this a manual task and in addition if they weren't what I was expecting then I needed to change them.

Shay Levy has very helpfully published a Stand Alone Registry Functions Library which I made use of. It allows you to query and set registry values for things such as DWords, Strings, Binary Values on remote machines very easily. In my case I was particularly interested in some configuration settings for the ICA protocol, HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\ICA-tcp, all of them DWords.

First of all we use Shay's Get-RegDWord function at the top of the script which contains some .NET code to query a remote registry

Then we specify the list of servers to query. You could either use something like:

$servers=Get-Contentservers.txt

or in my case they were all virtual servers in VMware so I used a couple of VI Toolkit commands to specify the list

# Connect to Virtual CenterConnect-VIServer vc

# Get a list of all the powered on APP servers$servers= Get-Folder 'Servers' | Get-VM | Where-Object {$_.Powerstate -eq'PoweredOn'}

Then we loop through each server, call Shay's Get-RegDWord function for each of the DWords we are interested in and store the results in the $myCOl variable. At the end we export the $myCol variable into a CSV file for handy viewing.

# Export the results to a csv file$myCol | Export-Csvcitrixservers.csv-NoTypeInformation

Now that we can view the results I was able to see that I needed to set a lot of these values to something new. Using Shay's Set-RegDWord function it is a pretty straightfoward task to extend the above to do that. First of all add the function to the top of the script.

First up on the night will be Richard Siddaway talking to us about using Regular Expressions in Powershell. This was requested at a previous event and I know that Richard is really looking forward to talking about that subject ;-)

Then the Get-Scripting guys will take over:

I will be talking about some of the features that are part of Active Directory in Server 2008 R2 , currently in beta, in particular the native AD Powershell cmdlets which will ship as part of that product and what I have learned about them so far.

vExpert Alan Renouf will then tell us about the VI toolkit, which for those of you not in the know are the cmdlets shipped by VMware to enable you to manage their ESX product.

A good mixture I think of general scripting skills, third-party added value to your Powershell learning and future technologies.

If you can't make the event in person then as usual it will be broadcast by LiveMeeting (details here). It wouldn't be a UK Powershell event if the LiveMeeting part doesn't go 100% to plan, but we will endeavour to ensure we avoid the usual trick of the microphone going on mute.

If you wish to attend the event in person you should contact Richard via his blog so that he can have a badge for you at the welcome desk. If the prospect of us presenting isn't enough to attract you then as always there will be pizza at half-time :-)

Tuesday, 10 March 2009

Today's UK VMware User Group was a great community content event. Of course there was a sponsor presentation (Veeam) without whom these type of events can't be put on, but there were also a lot of contributions from people in the group.

2) Mike Laverick from RTFM education talking about Site Recovery Manager and not the VMware view of it, rather real world struggles - warts and all as he put it. Its great to see this kind of content because you get to find out how these products really function in reality. He also gave away a few copies of his book on Site Recovery Manager which I'm sure is a must read for this topic.

3) Get-Scripting's very own vExpert Alan Renouf gave us a debrief from VMworld Europe in Cannes. By the sounds of it a great event, but possibly could be extended to include an extra day and maybe needs a bigger venue given the issues some people had getting into sessions.

4) A presentation from another community member about technology futures, 'the cloud', advances in mobile devices, stuff like that, and how they may affect the corporate world. This is now the second event I have been to which has talked about employee owned IT, i.e. you turn up to a job with your own laptop and corporate IT supply you either with a VM to run corporate applications or all delivered through a browser. The demand coming from cool, young, hip people (like me :-) ) who won't stand for the constraints of a corporate environment.

"Why can't I run facebook / second life / quake / twitter on my macbook / ipod/ pink netbook and just run your apps on the same machine too?"

Wednesday, 4 March 2009

Whilst monitoring some newly provisioned Citrix servers running on VMware hosts today, I soon became very bored with manually checking how many sessions were on each Citrix VM as the load on each one increased, whilst trying to get it to the optimum level.

I knew it was possible to use Powershell to connect with Citrix servers, but had never really looked into it before. Not surprisingly it turned out to be very straightforward.

By using some technology known as MFCom we can connect with the Citrix farm and get some cool information out.

In the below example we create a new com object using MFCom, then initialise the connection. We are then able to access some methods and properties of that object. In this case we are looking at the Sessions property, we group all of the results by ServerName and then produce some output with the name and number of sessions on that Citrix box.

This would return all of the servers in the farm. In this particular instance I only wanted a particular selection of servers, so I stored them in a text file, got PS to read that file and then filter the query by only looking at servers in that list.

Sunday, 22 February 2009

This is the second meeting of the newly formed UK Active Directory User Group:

The second [ADUG] UK Active Directory User Group meeting will be on the evening of the 11th March at Microsoft's London (Victoria) Offices. The meeting will co-hosted with the Windows Server User Group.

The draft agenda is:

18:00 for 18:25 Arrival and registration

18:25-18:30 Welcome and introductions

18:30-19:45 James O'Neill takes a quick tour through the new features in Windows Server 2008 R2 (just to whet your appetite).

19:45-20:00 Refreshments

20:00-21:15 Amish Lukka (also from Microsoft) will be presenting an insight into new Active Directory features in Windows Server 2008 R2.

21:15-21:30 Wrap-up.

21:20 Adjourn to a nearby public house where Mark Parris will be happy to share his experiences of the Microsoft Certified Masters: Windows Server 2008: Directory class that he attended last November.

If you are interested in attending - please send an email to registration@adug.co.uk with your name and see you there. The confirmed times will be in the confirmation email.

For those who can’t make it in person, we will set up a Live Meeting session (which will be recorded) and details will be made available closer to the event.

These are great events if you are able to get to them (unfortunately no webcast for this one):

The Steering Committee are pleased to announce the next UK London VMware UserGroup meeting, now kindly sponsored by Veeam Software, to be heldon Tuesday 10th March 2009. We hope to see you at the meeting, andafterwards for a drink or two.

Our meeting will be held at the Thames Suite, London Chamber of Commerce andIndustry, 33 Queen Street, London EC4R 1AP, +44 (0)20 7248 4444. The nearesttube station is Mansion House, location information is available here.

PLEASE NOTE: As well as the date changing from the previously-published one, the dayhas also changed to Tuesday, and we're in a different part of the venuefrom normal (out of the lift, turn right). Rest assured, the usual UGstaples of great content and me banging on about Powershell will bepresent and correct.

Reception is from 1230 for a prompt 1pm start, to finish around 5pm. Our agendafor is not final at the moment, but looks something like this:

Please feel free to contribute to the 'UG content ideas' forum thread running here. We won't be ableto incorporate all of the ideas for this coming meeting, but will do our bestto include some of them.

To register your interest in attending, please reply with up to two namedattendees from your organisation to alaricdavies at yahoo dot com. If you do not receive a confirmation mailfrom us, please don't just turn up since we will not be able to admit you tothe meeting. Content from the meetings will continue to be uploaded to http://public.box.net/londonug,NDA permitting.