All posts filed under: PoshUtils

Retrieve list of VMs excluded from SCVMM PRO/Dynamic Optimization

We can exclude VMs from SCVMM Performance and Resource Optimization (PRO) or Dynamic Optimization (DO). This is done at a VM level and there is no central place to see what all VMs are excluded from optimization. PowerShell to the rescue, of course. The Get-VM cmdlet in SCVMM module has a property called ExcludeFromPRO which tells us if a VM is excluded from PRO or DO. So, this is quite simple.

I will publish another post to show you where exactly this comes handy. Watch this space.

PoshUtils: Downloading SharePoint 2013 prerequisites for offline install

Okay, this is yet another post on downloading the SharePoint 2013 prerequisites for offline install. I am sure you have seen many and everyone has their own way. But I think none of those posts/scripts – at least the ones I read – don’t give you a unified way to download the prerequisites for all combinations of Windows Server OS and SQL Server versions. So, here is my take. The idea of this script is to use the features of PowerShell 3.0 such as Out-GridView and default parameter values to reduce the amount of code required. Note: The list of prerequisites I compiled here is what I perceived looking at technet documentation. Do let me know if I missed out anything or need to change something here. Let us see the code first.

In the above code, I am using a CSV file I compiled with all the SharePoint 2013 prerequisite information. This is the key here. You can download the CSV file here. Instead of a hash, I preferred to use a CSV file as …

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.

PoshUtils: Get-DBSize – Get SQL Database space usage

Here is an improved version of the script I am using to get the database space usage details. This is one of the utility scripts I have been using and will be publishing soon as PoshUtils on Codeplex. For this script to work, you need the SQL Management Object (SMO) assemblies. These assemblies are available on systems with SQL server installed or where SQL management tools are installed.

Here are some examples:

This gets the database space usage details for all databases on a SQL server named Server01.

The above example gets the space usage details for TestDB1 and TestDB2 on  a SQL Server named Server02.

This last example get the space usage details for TestDB1 and TestDB2 on the local SQL server. And, finally, you can avoid all parameters to get space usage for all databases on the local SQL Server. Here is how the output looks: