Monthly Archives: April 2010

GET-UPDATE | SEND-READERS

Powershell

For those of who have been loyally reading the blogs you’ll have been staring at what appeared to be an almost dead page.

Did the world fall apart?   Did Starbucks run out of Coffee?   Did “The Kraken” get tamed?

All valid questions.  Normally I find I blog and twitter like a madman.  As thoughts flow in my head, they get dumped out.  

So what happened?  An amazing and INCREDIBLY cool month!  Of course a busy one to boot at work.

First off, the month started off with a bang, as many of you are aware; I was nominated and received the Microsoft MVP award for Windows Powershell.   That just sent me spinning!  I was floored.  Smiling like and idiot, beaming everywhere at strangers for no reason.

Getting funny looks from my co-workers.

Then of course during the entire month of April was EVENT after EVENT after EVENT!  Energize IT 2010 occured here in Toronto as well as the normal ITPro Toronto meetings.  Tap that into my normal 15 hour day of work and commute and my schedule over floweth!

But then another piece surfaced.  I needed my passport!  A good friend advised me to sort that out since (in his words) “It would be a shame if you had to refuse presenting somewhere really cool just because of that”

Yes, a new passion lit inside of me.  For some silly reason, I now LIKE to present!  Standing in front of a crowd to see if they pull me off the stage.

So my passport needed to be renewed.  Something I haven’t done in … well a long enough time that it was a headache.   It took several booked appointments, finding the right paperwork and isolation from work without my cell phone during that time.

It is done.  Sorted out.  Which means I can now go to the one conference I have been waiting FOREVER to go to.  Microsoft TechEd 2010!  People thought I was “over the top” with Techdays here in Canada?  You’ve not seen nuthin’!

The month of April has quieted down and the following year is about to tear loose :)

So what does this all mean?   The Energized Tech is back and you know what that means.  I’m out, and it’s time to…

“Release the Kraken”

Sean
The Energized Tech

FacebookTwitterGoogle+Share

GET-UPDATE | SEND-READERS

Powershell

For those of who have been loyally reading the blogs you’ll have been staring at what appeared to be an almost dead page.

Did the world fall apart?   Did Starbucks run out of Coffee?   Did “The Kraken” get tamed?

All valid questions.  Normally I find I blog and twitter like a madman.  As thoughts flow in my head, they get dumped out.  

So what happened?  An amazing and INCREDIBLY cool month!  Of course a busy one to boot at work.

First off, the month started off with a bang, as many of you are aware; I was nominated and received the Microsoft MVP award for Windows Powershell.   That just sent me spinning!  I was floored.  Smiling like and idiot, beaming everywhere at strangers for no reason.

Getting funny looks from my co-workers.

Then of course during the entire month of April was EVENT after EVENT after EVENT!  Energize IT 2010 occured here in Toronto as well as the normal ITPro Toronto meetings.  Tap that into my normal 15 hour day of work and commute and my schedule over floweth!

But then another piece surfaced.  I needed my passport!  A good friend advised me to sort that out since (in his words) “It would be a shame if you had to refuse presenting somewhere really cool just because of that”

Yes, a new passion lit inside of me.  For some silly reason, I now LIKE to present!  Standing in front of a crowd to see if they pull me off the stage.

So my passport needed to be renewed.  Something I haven’t done in … well a long enough time that it was a headache.   It took several booked appointments, finding the right paperwork and isolation from work without my cell phone during that time.

It is done.  Sorted out.  Which means I can now go to the one conference I have been waiting FOREVER to go to.  Microsoft TechEd 2010!  People thought I was “over the top” with Techdays here in Canada?  You’ve not seen nuthin’!

The month of April has quieted down and the following year is about to tear loose :)

So what does this all mean?   The Energized Tech is back and you know what that means.  I’m out, and it’s time to…

“Release the Kraken”

Sean
The Energized Tech

FacebookTwitterGoogle+Share

Powershell – Create a Common Powershell Profile for all Network Users

Powershell

This article was initially intended for Network Administrators.  For a large corporation that wanted to standardize their Powershell setup.

Then I realized others could benefit from this.

If you’re aware of it, in Powershell there is a file based upon your Shell called your Profile.  Powershell ISE has it’s own Profile.

All the profile IS is just a BIG dumb text file you can fill with Powershell commands, functions, settings.  Nothing more than that.

It’s typical location is sitting on %USERPROFILE%\My Documents\WindowsPowershell\ and is usually called Microsoft.Powershell-profile.ps1 or Microsoft.PowershellISE-profile.ps1

And it’s format is just like a PS1 file.  No real difference.   But typically you’ll fill it with functions rather than Executing programs.  But you can use yours however you want.

My task today is to show you how to create a standard profile and pass it along to other administrators.

The easiest way is to just edit your profile the way you want and store is on a network location.  Name it something unique like “OURSTANDARD.PS1”

So “assuming” we have placed the file OURSTANDARD.PS1 on a common share like \\ASERVER\ABADLYNAMEFILESHARE all you need to do is create a NEW shortcut for Powershell launched with the following Parameters in Windows

“%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". ‘\\ASERVER\ABADLYNAMEDFILESHARE\OURSTANDARD.PS1’”

There! You’re done.  You only need deploy a standard Powershell Shortcut to your Network Administrators rather than trying to keep the latest profile passed about. 

And if you’re looking for a Standard Profile to work with?  Here’s something it could look like

—————– Start Profile Here ————————————-

# ABC DEF Ernie Gonzo and Cookie Monster Powershell Corporation
# Commented out so nobody can see this

FUNCTION GLOBAL:GET-PRAISE ( $Name ) { WRITE-HOST “$Name is the Greatest Administrator on the Planet!” }

WRITE-HOST ‘ABC Corporation – Powershell Administration Console’
WRITE-HOST ‘’
WRITE-HOST ‘Use GET-HELP to errrrrr….. well to GET-HELP’

————- End Profile Here ——————————————

Ok this profile is lame, really lame, COLOSALLY lame.   A little message on the screen and a new Function you can type called ‘GET-PRAISE’ to make yourself feel good.

But that’s all your profile is!  You can predefine Global functions (which could be standard Powershell scripts your normally use), common domain servers predefined or any number of things.

It’s only limited by your imagination.  And it’s easy to standardize and control. And remember…

The Power of Shell is in YOU!

Sean
The Energized Tech

FacebookTwitterGoogle+Share

Powershell – Create a Common Powershell Profile for all Network Users

Powershell

This article was initially intended for Network Administrators.  For a large corporation that wanted to standardize their Powershell setup.

Then I realized others could benefit from this.

If you’re aware of it, in Powershell there is a file based upon your Shell called your Profile.  Powershell ISE has it’s own Profile.

All the profile IS is just a BIG dumb text file you can fill with Powershell commands, functions, settings.  Nothing more than that.

It’s typical location is sitting on %USERPROFILE%\My Documents\WindowsPowershell\ and is usually called Microsoft.Powershell-profile.ps1 or Microsoft.PowershellISE-profile.ps1

And it’s format is just like a PS1 file.  No real difference.   But typically you’ll fill it with functions rather than Executing programs.  But you can use yours however you want.

My task today is to show you how to create a standard profile and pass it along to other administrators.

The easiest way is to just edit your profile the way you want and store is on a network location.  Name it something unique like “OURSTANDARD.PS1”

So “assuming” we have placed the file OURSTANDARD.PS1 on a common share like \\ASERVER\ABADLYNAMEFILESHARE all you need to do is create a NEW shortcut for Powershell launched with the following Parameters in Windows

“%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". ‘\\ASERVER\ABADLYNAMEDFILESHARE\OURSTANDARD.PS1’”

There! You’re done.  You only need deploy a standard Powershell Shortcut to your Network Administrators rather than trying to keep the latest profile passed about. 

And if you’re looking for a Standard Profile to work with?  Here’s something it could look like

—————– Start Profile Here ————————————-

# ABC DEF Ernie Gonzo and Cookie Monster Powershell Corporation
# Commented out so nobody can see this

FUNCTION GLOBAL:GET-PRAISE ( $Name ) { WRITE-HOST “$Name is the Greatest Administrator on the Planet!” }

WRITE-HOST ‘ABC Corporation – Powershell Administration Console’
WRITE-HOST ‘’
WRITE-HOST ‘Use GET-HELP to errrrrr….. well to GET-HELP’

————- End Profile Here ——————————————

Ok this profile is lame, really lame, COLOSALLY lame.   A little message on the screen and a new Function you can type called ‘GET-PRAISE’ to make yourself feel good.

But that’s all your profile is!  You can predefine Global functions (which could be standard Powershell scripts your normally use), common domain servers predefined or any number of things.

It’s only limited by your imagination.  And it’s easy to standardize and control. And remember…

The Power of Shell is in YOU!

Sean
The Energized Tech

FacebookTwitterGoogle+Share

Powershell – Checking my WINSAT score

Powershell

Powershell and WMI.  A perfect marriage (except for that little affair with vbScript but we’re going to steer CLEAR of THAT whole thing)

I was wondering just how fast my computer was.  If there was anyway to see how fast my machine based upon the new WINSAT scores.

What do you suppose is the possibility there is way to tell that?  EASILY?

With Powershell and WMI teamed together it’s too easy.

GET-WMIOBJECT WIN32-WINSAT

Now of course it’s going to try and give us a bit too much information.  Here’s the ones we’re really interested in.  But really we just want the IMPORTANT stuff.  A quick SELECT-OBJECT or proper FORMAT-TABLE will show you what you want.

GET-WMIOBJECT WIN32-WINSAT | SELECT-OBJECT CPUSCORE,D3DSCORE,DISKSCORE,GRAPHICSSCORE,MEMORYSCORE

or

GET-WMIOBJECT WIN32-WINSAT | FORMAT-TABLE CPUSCORE,D3DSCORE,DISKSCORE,GRAPHICSSCORE,MEMORYSCORE –autosize

So why is this useful?  The ability to read the WINSAT score can tell you if a system is running as optimally as it can or more importantly if it’s up to the task of the Aero Desktop. 

Yes.  You can tell this remotely without logging in and spending hours on Inventory.  Running this command

GET-WMIOBJECT WIN32-WINSAT –computername SOMECOMPUTER | SELECT-OBJECT WINSATASSESSMENTSTATE, WINSPRLEVEL

Will allow you to tell whether an assessment has been run (WINASSESSMENTSTATE will yield a ‘1’ if it has) or the WINSPRLEVEL (Your overall WINSAT score)

Hint:  If you see a WINASSESSMENTSTATE that isn’t ‘1’ with a WINSPRLEVEL of 1.0; good chance the Assessment has never been run and THAT is the reason your user can’t use the cool new features in Vista or Windows 7.

Now you can sit back and remotely check out your systems abilities and capabilities all thanks to Powershell and WMI.  The world’s more INEXPENSIVE hardware inventory!

The Power of Shell is in YOU!

Sean
The Energized Tech

FacebookTwitterGoogle+Share