Quick Post – Creating SMO Type Accelerators

I was reading the AWESOME post from my good friend Boe Prox :

Quick Hits: Finding, Creating and Removing PowerShell Type Accelerators

and in that post he shows how to create your own type accelerator.

Well, generally speaking, a type acellerator is a short cut to some place or, in the Boe words, “a shorthand type for a full .Net type”.

That means we can play around the SMO .net type and create some pretty cool stuff.

First we need to load the type acceleratos : (using Boe Code)

$accelerators = [PSObject].Assembly.GetType(‘System.Management.Automation.TypeAccelerators’)

Then it is just add the new type :

$accelerators ::add(‘TypeName’,’.Net type’)

Lets play around SMO and create a SMO Server type accelerator for the Server Class:


and I can access all the members using :

([smoserver]’vader’).Member   – IE :

A Property :


Or a Method


We can also add the Database Class :


Or Table class


This way you can add these code in your profile and load your type accelerator, simplifing your code.

Pretty cool !!!

Tkx Boe 🙂

About Laerte Junior

Laerte Junior Laerte Junior is a SQL Server specialist and an active member of WW SQL Server and the Windows PowerShell community. He also is a huge Star Wars fan (yes, he has the Darth Vader´s Helmet with the voice changer). He has a passion for DC comics and living the simple life. "May The Force be with all of us"
This entry was posted in Algo que Esqueci de Categorizar. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s