Must have Powershell snippets

Over the last few months my colleague Jon has been providing me with some very useful Powershell snippets which I thought I’d share. A number of them require the Quest ActiveRoles Management Shell for Active Directory

Display Group memberships for a user.

(Get-QADUser username).MemberOf

Display the members of an Active Directory Group

Get-QADGroupMember "Groupname" | ft name,displayname -a

Bulk remove machine from Windows DNS

The text file contains a list on NetBios machine names.

gc computers.txt | %{dnscmd dnsservername /RecordDelete "$_" A}

Recuse through a Directory Structure and delete all file with a Creation date > 90 days.

The text file contains a list of UNC paths.

GC filecontainingpaths.txt | %{dir $_ -recurse | ?{!$_.psiscontainer -and $_.creationtime -lt ((get-date).adddays(-90))} | del -whatif}

First Look at Office 2010

If you’re looking forward to the release of Office 2010 next summer (and let’s face it, who isn’t?!), then you probably already know about the availability of the public beta. If you’ve tried it, then it would be great if you could share your favourite features in the comments for others to share in your experience.

My personal favourite feature (so far – there are some things that I’m looking forward to trying in Outlook in conjunction with Exchange 2010, when we have that running) is the Backstage view in all the applications. This is the bit that you access via the “Office Button” in Office 2007, which is now accessed through a coloured “File” tab next to the ribbon’s default “Home” tab.

What I particularly like about Backstage is that they’ve brought the live-preview that was such a good addition in Office 2007 to the Print dialogue. You no longer have to look at print settings and print preview separately as they sit side by side. When you make a change to the setting, you see it reflected in the preview immediately. It makes formatting your printouts much more straight forward and will benefit pretty much everyone who uses Office.

I’ve been using Office 2010 since early on in the Technical Preview stage, before the Beta, but even so I haven’t come across all the tweaks in these new versions on the applications, so I was pleased to see that Microsoft Press have released a free ebook “First Look: Microsoft Office 2010”. At that price it’s a no-brainer to download it!

First Look: Microsoft Office 2010

How Item Count Impacts Outlook Performance

Apologies for the dry nature of this blog post, but I thought it important to give some background on why Outlook and more importantly Exchange often suffer performance issues. One of the main causes of poor performance is a user having high item counts in ‘Critical Path’ Outlook Folders and how Exchange deals with that.

Microsoft’s recommendations for Exchange 2007 are as follows:

“Ideally, it is best to keep the Inbox and Sent Items folders less than 20,000 items, and the Contacts and Calendar item counts less than 5,000. Even when maintaining item counts that are at or under the recommended maximum values, there are some operations which may still take noticeable time (usually this is approximately one minute). These operations include new sort orders and selecting folders for the first time. First time views of a folder can take even more time to generate the view. High item counts in critical path folders have an adverse effect on server performance because they are the most frequently accessed folders in a user’s mailbox. Other folders, especially custom folders that are created by end-users, can handle having larger numbers of items without having an adverse effect on the user experience because they are accessed less frequently. Be aware that, although the performance effect of having higher item counts in less frequently accessed folders is reduced, high item counts in these folders can still present intermittent performance issues as the number of folders like this increases, and the number of active users on the server increases.”

It is important to note that not only the user with high items counts will suffer a performance hit, but also all other users on the server.

Microsoft are keen to address this problem with Exchange 2010, they are changing their recommended maximum limits to 100,000 items. This is mainly due to big improvements in disk I/O performance and larger memory caches.

Other ways to address the performance issues are to use Cached Exchange Mode. This passes the performance required to the client computer, from the server. All of the views, searches, sorts etc. take place on the Cached Mode’s OST file. Of course, this is not the answer for everybody and should the mailbox have a massive amount of items and the OST file also be massive, then the user will still experience performance issues.

Housekeeping is the real answer and users should get into the habit of deleting old mail that they do not need to keep. Filing email from ‘critical path folders’ (Calendar, Contacts, Inbox and Sent Items) into user defined folders is also a big help.