Month: November 2012

PoshUtils: Get all mirrored SQL databases using PowerShell and SMO

I have been validating different aspects of SQL mirroring and in the process I wanted a quick and automated way to handle database mirroring functions. This includes listing all mirrored databases, failing over databases manually to a mirrored instance, etc. So, in the process, I created several small functions in PowerShell to achieve what I wanted. I will share these functions as a series of posts and eventually, will release a PoshUtils module. So, in today’s post, let us see how we can retrieve a list of all SQL databases that are mirrored. This function can work with both default and named instances. Also, this assumes that you are using Windows authentication. Let us see the function:

When you run the Get-MirroredDatabase function, it returns a list of all databases that are mirrored and all properties of each database. You can filter the output by selecting the properties you want.

Finding Lync contact capabilities using PowerShell

I wrote my last post on Finding Lync contact availability using PowerShell exactly a month ago! Life has been busy. I had my Masters exams and then lot of backlog at work! Well, I am back and it feels good to be writing again. As a continuation to the Lync series of posts, I will show you how to find the Lync conact capabilities using PowerShell. This is especially important when we want to automatically invoke a voice call or a video chat with a Lync contact. The method for this is very similar to finding the Lync contact availability. If you don’t have Lync SDK installed (it comes with a lot of unnecessary baggage), you can just copy the model DLL at ”C:\Program Files (x86)\Microsoft Lync\SDK\Assemblies\Desktop\Microsoft.Lync.Model.Dll” from a machine that has Lync SDK installed. This should be sufficient for the task outlined in this post. For today’s post, we will once again look at the ContactManager class. As usual, let us first get the Lync Model namespace loaded.

Once we have the $client instance, we can use the GetContactByUri method in ContactManager …