Archive

Archive for December, 2008

PowerShell v2 CTP3 released, works fine with OpsMgr

December 23rd, 2008 jpavleck 1 comment

I would have posted this yesterday, but I wanted to do some testing first. Twelve hours ago the PowerShell team announced the release of V2 CTP3. It adds a lot of great things into the mix. I wanted to verify that it plays well with OpsMgr and as suspected it does.

Just a note – you’ll need to install PowerShell v1 for a new OpsMgr install. But you can then remove it and install a newer version. I typically run the newest v2 CTP release on my laptop, though I remain at v1 on the production servers.

Happy holidays all!

Just a bit of PoSh – show your battery level at the prompt

December 19th, 2008 jpavleck 2 comments

I’ve been working on a new, more condensed version of the OpsMgr PoSh library – one of the coolest features I think is the ‘location awareness’ which automatically switches your management server and such based on where you’re actually connected from.

Anyway, to do that I was embedding things in function prompt {}. In case you aren’t aware, if you define the prompt function, whatever is in there will run everytime you return to the prompt in the console. You can use this to your advantage for many things, such as this nifty little battery gauge that lets you know how much juice is left. It also has a configurable global variable, BatteryDisplayAtPercent, which you can set so it will hide until there is that much charge or less remaining.

First a screenshot, then the script:

battery-prompt

# ==============================================================================================
#
# Microsoft PowerShell Source File — Created with SAPIEN Technologies PrimalScript 2007
#
# NAME: Battery-Prompt.ps1
#
# AUTHOR: Jeremy D. Pavleck , Pavleck.NET
# DATE  : 12/14/2008
#
# COMMENT: Lists the percentage of battery remaining above your prompt inside the console.
#    Difficulty level: OVER 9000!!!!!!!!!!!!!!!!
#
# ==============================================================================================
$GLOBAL:BatteryDisplayAtPercent = 101 # When you should start displaying status
# Anything over 100 means to show it all
Function GLOBAL:Get-BattLevel($minLevel) {
$charge = (Get-WmiObject -Class Win32_Battery).EstimatedChargeRemaining
If(!$charge) {break} # Not on a laptop, or no battery, so exit
Switch($charge) {
{($charge -ge 101) -and ($minLevel -ge 101)} {Write-Host "Batt: CHARGING" -ForeGroundColor Green}
{($charge -ge 80) -and ($charge -le 100) -and ($charge -le $minLevel)} {Write-Host "Batt: $charge%" -ForeGroundColor Green}
{($charge -ge 40) -and ($charge -le 79) -and ($charge -le $minLevel)} {Write-Host "Batt: $charge%" -ForeGroundColor Yellow}
{($charge -ge 16) -and ($charge -le 39) -and ($charge -le $minLevel)} {Write-Host "Batt: $charge%" -ForeGroundColor Magenta}
{($charge -ge 1) -and ($charge -le 15) -and ($charge -le $minLevel)} {Write-Host "Batt: $charge%" -ForeGroundColor Red}
default {break}
}
}

function prompt() {
Get-BattLevel $GLOBAL:BatteryDisplayAtPercent
}

Categories: Powershell Tags: , ,

OpsMgr Video Experiment: Ask About OpsMgr

December 18th, 2008 jpavleck 4 comments

I’ve been reading and hearing all over the place how complicated and difficule Operations Manager is. You’re half-right. It’s immensely complicated when compared to previous editions, and when it’s your first exposure to it. I’m aiming to change all that, and I’m trying it in a new medium – video! So watch the video below (Or if your firewall rules don’t prohibit it, go directly to the YouTube link) and post a video response asking me your question. Any question.

I’ll do my best to answer it with the help of the OpsMgr Army and screencast it all!

Management Pack Authoring 101

December 17th, 2008 jpavleck No comments

This post deals with 2 situations I’ve come across time and time again. One is the lack of documentation about any customizations made and the other is the general lack of any decent tutorials on using the authoring console – so I’ll combine them!

Documentation – the bane of any monitoring engineer. With a system such as OpsMgr, a lot of it is self-aware and as such, rules and monitors will deploy on their own according to what happens in a server. Someone installs IIS? Well then OpsMgr will notice and download the appropriate rules and monitors and assign them to the new groups they belong to.  That’s a tough thing to stay on top of, and once I have an OpsMgr 07 version of MOMDOC, I’ll release it and make all of our lives easier – until then you’ll have to put up with it.
The other side of documentation is the general lack of it with regards to custom rules, monitors, transactions and changes made to ‘out of the box’ rules. This is a very solveable problem!

First off, go ahead and download the Authoring Console. It’s been out for 8 months now, and technically not needed for this particular management pack, but it’s a great way to ease into how it all works.

For this demonstration, I’m going to create a management pack which makes a new task called “Search Internal Documentation”. This task simply opens a browser window appending the alert name to a URL for an internal ScrewTurn Wiki. ScrewTurn is a great open-source ASP.Net wiki which doesn’t require an SQL database, making it very easy to ’sneak in under the radar’ in a lot of environments.

After you’ve downloaded, installed, and opened the Authoring Console, click on File > New, to create a new management pack. Under “Management Pack Template” click on “Empty Management Pack” and give it a name – I used Internal.Documentation.Search

Selecting an MP template and name it

Selecting an MP template and name it

Click on “Next” and give it a Display Name and Description. Use what I did, or enter your own information.

Entering display name and description

Entering display name and description

Immediately you’re assaulted with a whole army of choices; Sevice Model, Health Model, Presentation, Type Library, Language Packs, and all of the things inside of those. We’ll get to all of those, eventually, but for now click on the ‘Presentation’ tab on the left, then New and Console Task on the right.

SCOM - New Console Task

SCOM - New Console Task

Up will pop up a window asking for a unique identifier. This is an internal reference used inside the Management Pack, so give it a descriptive name, something like “Search.Wiki”.

Choosing a Unique Identifier

Choosing a Unique Identifier

Click ok, and now you have all of the options for our new task.

The ‘General’ tab is where you give your task a public name, description and choose the target. You can see from my example I’ve named this task “Search the Wiki” with the description of “Search the internal wiki about this alert”. Under the target click to expand it, choose ‘Browse all classes’, then search for the “System.Entity”. This will allow our task to be shown and run against all alerts from all management packs.

The general pane of the new task window

The general pane of the new task window

Now click on the ‘Command Line’ tab – this is where the meat of it is. Here is where we define exactly what our task will do.

Command Line pane showing the definitions for the task

Command Line pane showing the definitions for the task

As you can see from my example above, I’ve specified the command line options to open up our Wiki. The command line application was set to use Internet Explorer1, and the parameter I use is the URL t0 the wiki with $NAME$ (The alert name) and “.ashx” appended to it.

Tip: If you’d rather have the URL opened in whatever the default browser the user has, you can change the application to use start.exe to open it, or even just use the URL itself. If it’s a known extension, it will be opened by whatever the default handler is for it.

Product knowledge is what we’re used to, enter what you see fit in here, then click on the Options tab and change Accessibility to “Public”, and Category to “Alert”. This allows the task to be used directly from the console, and shown in any alert view.

Setting the additional options

Setting the additional options

Then click OK, it will crunch for a little bit saving your changes, and then bam – there you go – a brand new task is born!

The completed new task

The completed new task

Now click on File > Save, choose a spot (and a name if you’d like) and there you have it, a brand new management pack. Now go ahead and import it, like you’d import any management pack. Click on the Monitoring tab, then on Active Alerts and select an alert. In the actions pane you should see our new task shown under the “Alert Tasks” heading.

Our new 'Search the Wiki' task

Our new 'Search the Wiki' task

For this example I highlighted an alert that was “Percentage of Committed Memory in Use Too High” and clicked on ‘Search the wiki’. Since that page doesn’t yet exist, it suggested a few I’ve created that sound close to it, or alternatively you have the option to create it as a brand new page. Pretty slick, eh?

scom-authoring-10-examplewebpage

  1. If you use a different default browser at your organization, then enter it’s path here []

Congrats to our winners!

December 12th, 2008 jpavleck No comments

Congratulations are in order to Jim and Zolon, they won an autographed Operations Manager 2007 Unleashed and a Sapien Schwag pack – who will win next? Maybe it’s you! The prizes are getting better and better!

Thanks guys, I’ll be sending them out asap!

Categories: Contests, Pavleck.NET Tags:

TODO: Enter snappy title

December 10th, 2008 jpavleck No comments

Please forgive the delay in posts, but trust me, I’ve been busy.

Shortly after this post I’m going to make a valiant attempt to get the new site up. Though I’ve learned that to import a Wordpress blog into Drupal, I need to install Drupal 5, run an import, then upgrade to 6. So yeah, we’ll see how that goes.

For the past several days I’ve been in an MS workshop entitled ‘Vital Signs’. It’s essentially a performance tuning course which focused on the counters and thresholds to watch out for. To commemorate the occassion, I’m working on a Windows Diagnostics Management Pack – which is mostly a group of tasks to run against a remote machine – collecting a variety of counters and analyzing it via SPA.

You’ve got about 5 hours to enter the contest, and then it’s all done. I’ve lined up additional items for upcoming contests, such as the top notch screen capture program Snagit by TechSmith. Thanks to them for that!

And I’ve been doing a lot of non-OpsMgr powershell work. Since I did intend for Pavleck.NET to include ‘general’ IT topics, I think I should start posting them – been working on a bunch of Amazon web services stuff.

Anyway, off to work on this upgrade!

Contest extended, Wiki Updated

December 2nd, 2008 jpavleck No comments

Hey folks!

I’ve gone an extended last month’s contest a couple of weeks because I’m waiting for my lanyards to show up AND I really want more people to have signed up, because the prizes are just going to keep on getting better! So if you haven’t, go sign up @ Contest Machine – I don’t keep any personal info, seriously!

I’ve also worked over the weekend to cleanup the OpsMgr Wiki some – so please have a look. You can find all of the Command Shell cmdLet help, there’s a snapshot of the MS OpsMgr blogs, and even some management pack version info.

Additionally, the next few things I’m working on are an extension to the OpsMgr audible alert – I’ll show you 2 more ways to do it; Via WinRM & PowerShell and via a custom web service and connector. Look for that, soon!