Powershell–Death to the SQL MiniShell ! I want a REAL Console!


Ok yes.

I’m being dramatic.  But I got your attention!

If you’ve worked on ANY level with Microsoft SQL Server 2008 and SQL Server 2008R2 you’ll know there are Windows Powershell Cmdlets.   The problem is it’s via “MiniShell” which is a sort of bastardized version of Powershell customized for SQL.

Well not REALLY but there is no shortcut for it.

No wait, I lied.  There is.  But it’s shortcut to an evil compiled “Quasi” Powershell session.   But it DOES use snapins.  But when you’re IN the “Mini-Shell” (Strikes me as “Mini-Me” accomplice to Dr. Evil) it won’t LET you run the “useful stuff” like “GET-PSSNAPIN”

But AHA! It *IS* using Snapins and those Snapins ARE Registered.

So by opening Windows Powershell and keying in

GET-PSSNAPIN –Registered

We get a handy output like this


So we could just add this our Profile but today I would like to just make a CUSTOM Powershell session with a Shortcut.

“Just cuz!”

So if you keyed in Powershell.exe /? within Cmd.exe or Powershell.exe you’ll see a pile of useful parameters you can use.  These are especially useful if you intend to schedule Powershell scripts as a task.  Today we’re just going to leverage the “-command” and “-noexit” parameters as we create a new Shortcut in Windows to launch our new Custom shell.

So within Windows on the Desktop, we’re just going to Right Click and choose “New Shortcut” which will launch that old familiar Wizard.  We’re going to Browse to “C:WindowsSystem32WindowsPowershellv1.0powershell.exe”




Once we have the shortcut selected, let’s “NEXT” and name that “SQL Powershell Console” (You could name it Ernie or Joey, but that might be more confusing later on when you need to use it)

After you complete, pull up the Properties on your new shortcut and you’ll to add the following info after “Powershell.exe”

-noexit -command "& {ADD-PSSNAPIN SQLServerCmdletSnapin100; ADD-PSSNAPIN SQLServerProviderSnapin100}"

Now believe it or not, this ACTUALLY makes sense.  No really, I’m not pulling your leg.

“-noexit” Means after you Launch the Powershell session and run the Cmdlets or commands provided in the Command parameter, keep Powershell open.  Yes “DON’T EXIT”

“-command” Means to run the following commands in Powershell.  In our case we’re going to execute the two ADD-PSSNAPIN Cmdlets to add the SQL Server Management Snapins.  The Semicolon separating them is exactly what you think it means.  “End of this line”.  It’s the demark between one Powershell CmdLet and another.   Handy if we can’t put an invisible carriage return in there.

When you see the “& “ that means to send everything to Powershell EXACTLY as you see it.  Also note, when doing this technique, the –command parameter and all it’s goodies must be the LAST thing in the line.

Click on “Apply” and try your new Shortcut.  Doesn’t seem to do anything magic?  Of course not.   That’s because this is a normal Windows Powershell console with the SQL Snapins added in and AVAILABLE to you.

How do you tell they are there?



There you go.  

So is there a point to ANY of this?  Sure there is.  Ever have to create a new User?  Is there any chance you might have a Vendor or inhouse application storing it’s OWN variant on user information in an SQL database?

Maybe not?

Take this to note.   It’s not difficult to add additional Snap-ins or modules this way.   It’s just another way of shaping Powershell to your own needs.

Remember, the Power of Shell is in YOU

The Energized Tech

Powershell – Systems Center Virtual Machine Manager–Identify Properties of Virtual Machines


Here’s your challenge.  Sometimes, no matter what you do, mistakes get made.   People create virtual Machines with the wrong Network Adapter time; Machines don’t migrate because of Server type mismatches.   Computers may not Autostart, simply because somebody forgot to enable the option.

That’s right.  Problems will Happen.   But with the Powershell Cmdlets in Systems Center Virtual Machine Manager 2008R2, this is less of a issue.   Because often if we have a list of things we can easily identify the problem and determine how to best resolve it.

Need to identify which machines ARE NOT starting up Automatically ?  Within SCVMM just execute this line to get a list of Machines to work with.


Now you have a complete list of your Hyper-V Machines managed by SCVMM.   Once you have the list, there is a series of properties available with GET-MEMBER.


You can now pull up the “Start Action” on all your Virtual Machines (and the stop) with this simple line

$VMLIST | Format-Table Name,Startaction,Stopaction –autosize

You can even filter this list down to show only the machines that aren’t starting automatically.

$VMLIST | Where { $-.StartAction –eq ‘Never AutoTurnOnVM’ } | Format-Table Name,StartAction,StopAction –autosize

Now do you have some Hyper-V servers with newer processors and some with older?   When migrating you can go forward in technology.  Going back is tricky unless you TELL the Virtual machine it can.

To identify those machines that can’t step back you need to check for the LimitCPUForMigration

$VMLIST | Where { $-.LimitCPUForMigration –eq $FALSE } | Format-table Name

Now if for any reason you’re unsure if your Virtual Machines have their Virtual Machine Additions, you can run a simply one liner again.

$VMLIST | format-table Name,HasVMAdditions

Now here’s a useful function to show you all the Computers in the Hyper-V environment that are still running with Legacy Network Adapters.

Foreach ($Machine in $AllVM )
    Foreach ($Adapter in $Adapterlist)
        IF ($Adapter.VirtualNetworkAdapterType -ne ‘Synthetic’)
            WRITE-HOST $Machine.Name,$Adapter.VirtualNetworkAdapterType,$Adapter.VMNetworkOptimizationsEnabled

Why bother with this?  The more native your Hyper-V environment is, the fewer problems you can encounter.   Also when working with Systems Center Data Protection Manager and Hyper-V, you’ll want to make sure everything is as correct as possible to avoid that irritating “Backup Using Saved System State”,  a fallback backup method in DPM for Hyper-V Child Partitions.

All done with Powershell and a few minutes of typing.

Remember, the Power of Shell is in YOU
The Energized Tech

Springboard CONTEST at Microsoft–Great Windows 7 Stories ! Get them out now!

Yes you TOO could win a copy of Windows 7 Ultimate!  Just tell us your story! check out this amazing contest at Microsoft!   Hurry up and submit entries before January 31st!


Win a copy of Windows 7 Ultimate in our “Best Windows Story” Contest

We’re giving away a copy of Windows 7 Ultimate to the ten (10) best Windows stories from IT Professionals. Stories can be related to how Windows 7 saved your company money, solving your application compatibility issues, deployment, management of your installations, and virtually anything else. The more compelling your story, the better chance you have to win.


PLEASE NOTE:  It is your sole responsibility to review and understand your employer’s policies regarding your eligibility to participate in trade promotions.  If you are participating in violation of your employer’s policies, you may be disqualified from entering or receiving prizes.  Microsoft disclaims any and all liability or responsibility for disputes arising between an employee and their employer related to this matter, and prizes will only be awarded in compliance with the employer’s policies.

GOVERNMENT EMPLOYEES: Microsoft is committed to complying with government gift and ethics rules and therefore government employees are not eligible.

This Contest is hosted in the United States, and entry information is collected on computers in the United States. This Contest will be governed by the laws of the State of Washington, and you consent to the exclusive jurisdiction and venue of the courts of the State of Washington for any disputes arising out of this Contest. If you do not agree with this provision and these Official Rules, please do not enter this Contest.


These are the official rules that govern how the Microsoft Best Windows Story contest promotion will operate (“Contest”). In these rules, “we,” “our,” and “us” refer to Microsoft Corporation, the sponsor of this Contest.  “You” refers to an eligible Contest entrant.


This is a skill-based Contest.

The object of this Contest is to recognize your story about how implementing Windows 7 has helped your business. Stories can describe how Windows 7 saved your company money, solved for application compatibility issues, helped with deployment or management of your installations, or virtually anything else. For purposes of this Contest, each “story” you submit will be called an entry. All eligible entries received will be judged using the criteria described below to determine the winners of the prizes described below.


This Contest starts at 12:01 a.m. Pacific Time (PT) on December 15, 2010 and ends at 11:59 p.m. PT on January 31, 2011 (“Entry Period”).


You are eligible to enter this Contest if you meet the following requirements at time entry:

  • You are an IT Professional 18 years of age or older whose business has previously deployed Windows 7;  and
    • If you are 18 of age or older, but are considered a minor in your place of residence, you should ask your parent’s or legal guardian’s permission prior to submitting an entry into this Contest; and
  • You are NOT a resident of any of the following countries: Cuba, Iran, North Korea, Sudan, and Syria.
    • PLEASE NOTE: U.S. export regulations prohibit the export of goods and services to Cuba, Iran, North Korea, Sudan and Syria. Therefore residents of these countries / regions are not eligible to participate.
  • You are NOT an employee of Microsoft Corporation or an employee of a Microsoft subsidiary; and
  • You are NOT involved in any part of the administration and execution of this Contest; and
  • You are NOT an immediate family (parent, sibling, spouse, child) or household member of a Microsoft employee, an employee of a Microsoft subsidiary, or a person involved in any part of the administration and execution of this Contest.

This Contest is void outside the geographic area described above and wherever else prohibited by law.


To be eligible for judging an entry must meet the following content / technical requirements:

  • Story must be no more than 2 double spaced pages with normal margins.
  • Story must be about how your business was helped by implementing Windows 7 or migrating to Windows 7 from Windows XP or Windows Vista.
  • Story must be written and submitted in English
  • Story must be submitted in .doc or .docx format to WinStory@microsoft.com no later than January 31, 2011 at midnight Pacific time.

In addition:

  • your entry must be your own original work; and
  • your entry cannot have been selected as a winner in any other contest; and
  • you must have obtained any and all consents, approvals or licenses required for you to submit your entry; and
  • your entry must not otherwise violate the rights of any other person or company by using their trademarks, music, logos, names or images without their express written consent.

Entries may NOT contain, as determined by us, in our sole and absolute discretion, any content that:

  • is sexually explicit, unnecessarily violent or derogatory of any ethnic, racial, gender, religious, professional or age group; profane or pornographic;
  • promotes alcohol, illegal drugs, tobacco, firearms/weapons (or the use of any of the foregoing) or a particular political agenda;
  • is obscene or offensive;
  • defames, misrepresents or contains disparaging remarks about other people or companies;
  • communicates messages or images inconsistent with the positive images and/or good will to which we wish to associate; and/or violates any law;

We reserve the right to reject any entry, in our sole and absolute discretion, that we determine does not meet the above criteria.


Other than what is set forth below, we are not claiming any ownership rights to your entry.  However, by submitting your entry, you:

  • are granting us an irrevocable, royalty-free, worldwide right and license to: (i) use, review, assess, test and otherwise analyze your entry and all its content in connection with this Contest; and (ii) feature your entry and all content in connection with the marketing, sale, or promotion of this Contest (including but not limited to internal and external sales meetings, conference presentations, tradeshows, and screen shots of the Contest entry in press releases) in all media (now known or later developed)
  • agree to sign any necessary documentation that may be required for us and our designees to make use of the rights you granted above;
  • understand and acknowledge that the Promotion Parties may have developed or commissioned materials similar or identical to your submission and you waive any claims you may have resulting from any similarities to your entry; 
  • understand that we cannot control the incoming information you will disclose to our representatives in the course of entering, or what our representatives will remember about your entry. You also understand that we will not restrict work ass
    ignments of representatives
    who have had access to your entry.  By entering this Contest, you agree that use of information in our representatives’ unaided memories in the development or deployment of our products or services does not create liability for us under this agreement or copyright or trade secret law; 
  • understand that you will not receive any compensation or credit for use of your entry, other than what is described in these Official Rules

Please note that following the end of this Contest your entry may be posted on a website selected by us for viewing by visitors to that website.  We are not responsible for any unauthorized use of your entry by visitors to this website.  While we reserve these rights, we are not obligated to use your entry for any purpose, even if it has been selected as a winning entry.

If you do not want to grant us these rights to your entry, please do not enter this Contest.


To enter, send an email to WinStory@microsoft.com. Emails must include your story as an attachment and your contact information including first/last name, business, and email address.

By submitting your story, you will receive one (1) entry into the Contest.

We will only accept one (1) entry per person.

We are not responsible for entries that we do not receive for any reason, or for entries that we receive but are not decipherable for any reason.

We will automatically disqualify:

  • Any incomplete or illegible entry; and
  • Any entries that we receive from you that are in excess of the entry limit described above.


On or around February 28, 2011, a panel of judges will review all eligible entries received and select ten (10) winners of the Contest Prizes described below based upon judging criteria described below.

Judging Criteria

  • 25% – Compelling story about the value Windows 7 provides to your organization
  • 25% – Ability to overcome migration or deployment challenges
  • 25% – Solutions used to overcome challenges
  • 25% – Ability to clearly document your story

The decisions of the judges are final and binding.  If we do not receive a sufficient number of entries meeting the entry requirements, we may, at our discretion, select fewer winners than described above.

In the event of a tie between any eligible entries, an additional judge will break the tie based on the judging criteria described above.  The decisions of the judges are final and binding.  If we do not receive a sufficient number of entries meeting the entry requirements, we may, at our discretion, select fewer winners than the number of Contest Prizes described below.

Contest Prizes

Ten (10) Grand Prize. A Not for Resale English version of Microsoft Windows 7 Ultimate. Approximate Retail Value (ARV) $299.99.

The total Approximate Retail Value (ARV) of all prizes: $2999.90

We will only award one (1) prize per person.

If you are a potential winner, we will notify you by sending a message to the e-mail address, the phone number, or mailing address (if any) provided at time of entry within seven (7) days following completion of judging.  If the notification that we send is returned as undeliverable, or you are otherwise unreachable for any reason, we may award to a runner-up.

If there is a dispute as to who is the potential winner, we will consider the potential winner to be the authorized account holder of the e-mail address used to enter the Contest. If you are a potential winner, we may require you to sign an Affidavit of Eligibility, Liability/Publicity Release and a W-9 tax form or W-8 BEN tax form within 10 days of notification. If you are a potential winner and you are 18 or older, but are considered a minor in your place of legal residence, we may require your parent or legal guardian to sign all required forms on your behalf.  If you do not complete the required forms as instructed and/or return the required forms within the time period listed on the winner notification message, we may disqualify you and select a runner-up.

If you are confirmed as a winner of this Contest:

  • You may not exchange your prize for cash or any other merchandise or services.  However, if for any reason an advertised prize is unavailable, we reserve the right to substitute a prize of equal or greater value; and
  • You may not designate someone else as the winner.  If you are unable or unwilling to accept your prize, we may award it to a runner up; and
  • If you accept a prize, you will be solely responsible for all applicable taxes related to accepting the prize; and
  • If you are otherwise eligible for this Contest, but are considered a minor in your place of residence, we may award the prize to your parent/legal guardian on your behalf; and
  • Unless otherwise noted, all prizes are subject to their manufacturer’s warranty and / or terms and conditions. 


By entering this Contest you agree:

  • To abide by these Official Rules; and
  • To release and hold harmless Microsoft and its respective parents, subsidiaries, affiliates, employees and agents from any and all liability or any injury, loss or damage of any kind arising from or in connection with this Contest, or any prize won; and
  • That Microsoft’s decisions will be final and binding on all matters related to this Contest; and
  • That, by accepting a prize, Microsoft may use of your proper name and state of residence online and in print, or in any other media, in connection with this Contest, without payment or compensation to you, except where prohibited by law.


This Contest will be governed by the laws of the State of Washington, and you consent to the exclusive jurisdiction and venue of the courts of the State of Washington for any disputes arising out of this Contest. 


If someone cheats, or a virus, bug, catastrophic event, or any other unforeseen or unexpected event that cannot be reasonably anticipated or controlled, (also referred to as force majeure) affects the fairness and / or integrity of this Contest, we reserve the right to cancel, change or suspend this Contest.  This right is reserved whether the event is due to human or technical error. If a solution cannot be found to restore the integrity of the Contest, we reserve the right to select winners from among all eligible entries received before we had to cancel, change or suspend the Contest.

If you attempt to compromise the integrity or the legitimate operation of this Contest by hacking or by cheating or committing fraud in ANY way, we may seek damages from you to the fullest extent permitted by law.  Further, we may ban you from participating in any of our future Contest, so please play fairly.


To request a winners list, please send an email to WinStory@microsoft.com and we will provide you with a list of winner who received a prize worth $25.00 or more. This list will be available until March 31, 2011.


Microsoft Corporation
One Microsoft Way
Redmond, WA 98052