Showing posts with label opsmgr. Show all posts
Showing posts with label opsmgr. Show all posts

Friday, January 9, 2009

PowerShell Challenge 2009

Over on the System Center Forum site HERE, I posted a challenge late in 2008 HERE.

Basically, I'm challenging anyone to come up with some kind of automation scenario for Operations Manager 2007 that they think I can't automate. Of course there are some things that might just not be possible, but I'm leaving that to everyone out there to find something I can't solve!

I'm offering at least $100US to the person who provides the best challenge, and will likely offer at least $50US to 2nd and 3rd place.

It didn't take Tim McFadden to come up with a good one for me (check the comments HERE). I do have a solution for his challenge, and just need to write it up in a blog post.

Sunday, December 14, 2008

OpsMgr Shell: Another advanced example of PowerShell and the SDK

Here's another post on advanced usage of the OpsMgr SDK and PowerShell. As I get into more complicated things, it seems I keep running into .NET Generics and collections more and more.

I had quite the time when I came across a read-only collection, and needed to edit it. Fortunately, Jaykul, Oisin and Bruce Payette all came to my rescue.

The result is HERE, where I show:
1. How I am handed a read-only collection by the OpsMgr SDK.
2. I recreate a new generic list with just the elements I want from that read-only collection.
3. Then recreate that read-only collection using my new list.

Wow!

Saturday, December 6, 2008

OpsMgr Shell: Advanced example using PowerShell and the SDK

I've got a new post up HERE on the System Center Forum site.

The title is "Advanced example using PowerShell and the OpsMgr SDK: Creating and Updating Groups". I basically translate a post from Jakub Olesky HERE.

I'm going to do a few more related blog posts where I split the above code into two functions/scripts.

Thursday, November 27, 2008

PowerShell in OpsMgr 2007 R2 (beta 1)--Operations Manager Shell

Recently, Microsoft released System Center Operations Manager 2007 R2. This is *not* a SP release, but a new product. I won't go into the licensing details of this as others have covered it, and a search should get you answers.

I haven't seen anyone actually mention PowerShell at all when discussing the new release.

I'm going to try to spend some time this week and next looking for any PowerShell-related changes.

One thing to note at this point is that the "Command Shell" (see note 1 below) appears to have been renamed to "Operations Manager Shell". The decision was likely to follow along with Exchange, where they have their PowerShell extension named "Exchange Management Shell" or "EMS".

As a result, I'm now going to start using the tag "OpsMgr Shell" when referring to the OpsMgr R2 release, and likely any future releases of OpsMgr down the road likely in 2010 or so (that's nothing official or unofficial... I'm just throwing that date out there).

Note 1: The OpsMgr custom PowerShell console pre-loaded with the OpsMgr PowerShell extensions.

Wednesday, November 19, 2008

Command Shell: Tip when using criteria with Get-MonitoringObject

Another guest blog on the System Center Forum site HERE.

I discuss an odd scenario where some OpsMgr Command Shell commands produce an object with a NoteProperty property type. I briefly talk about what a NoteProperty is in PowerShell, then I I show how to reproduce the particular problem, and how to workaround it using the OpsMgr SDK.

Pete Zerger, founder of the System Center Forum site, also uses some of the things I discuss HERE to create a Dell Server Inventory Report from OpsMgr using the Command Shell.

Tuesday, November 4, 2008

Command Shell: OpsMgr Automation Introduction

[Update: November 18th, 2008: Updated System Center URL.]

I've started doing some guest blogging on the great System Center Forum site. My first post is HERE.

I'm doing a series on OpsMgr automation using a simple example like the Command Shell's get-agent cmdlet.

I'm going to attempt to show at least 5 ways that one can duplicate the get-alert cmdlet:

1. The simplest way to list the alerts is via the OpsMgr Command Shell by simply using the get-alert cmdlet.
2. Still using the Command Shell, I could use PowerShell’s .NET functionality to use the OpsMgr SDK .NET assemblies directly from within the console.
3. Using the OpsMgr SDK .NET assemblies, a C# console application could be created to duplicate the same functionality.
4. Similar to what was done for SQL Server 2008, a PowerShell “clone”, also known as a “minishell”, can be created that can also work as a console application.
5. A custom PowerShell runspace can be used, which is the method the Exchange 2007 Management Shell (which is PowerShell with some add-ons for Exchange management/administration) must be integrated into C# applications because of the absence of any other public API.

Check it out!

Monday, October 27, 2008

Command Shell: Set-MaintenanceWindow with an end time of now

Reported on MS Connect HERE.

I view this more as an issue. Please vote if you come across this problem by following the link above. There is a bit more information if you follow the link also.

Summary:
----------------------
When a maintenance window has been created, if "Set-MaintenanceWindow -endtime $(get-date)" is used, it will output an error:
-------------------------------
Set-MaintenanceWindow : Cannot set scheduled end time to a time in the past
-------------------------------

There seems to be a small delay in processing the command, simply doing this works:
Set-MaintenanceWindow -endtime $(get-date).addseconds(1)

The cmdlet should gracefully accept a end time of "now".
----------------------

Command Shell: Get-MaintenanceWindow reports datetime in UTC

Reported on Microsoft Connect HERE.

See the summary below. Go to the above link to view the full details. I added this more as feedback versus adding it as an issue (it isn't an actual "trouble").

Please use the above link to vote on the issue if you think this should be resolved by the OpsMgr team.

Summary:
----------------------
Get-MaintenanceWindow reports StartTime and ScheduledEndTime property as the UTC time (ignoring the local timezone).

Example below, the current time is approximately:
Monday, October 27, 2008 7:15:14 PM

When the New-MaintenanceWindow cmdlet is used to create a maintenance window starting immediately, using Get-MaintenanceWindow immediately after, the StartTime shows as:
(Monday, October 27, 2008 7:15:14 PM)+6 (Timezone value)-1 (not DST)=10/28/2008 12:14:58 AM

So it appears, the StartTime property follows the above formula to display the value to the console via the Command Shell.

Get-MaintenanceWindow should report Date/time properties while accounting for the local timezone settings.
----------------------

Saturday, October 18, 2008

Command Shell: Microsoft introduction video

This has been available online for several months, but I wanted to add a link to it on my blog.

Roger Sprague from the OpsMgr team did this great into video on the Command Shell HERE.

Definitely worth watching for people new to the OpsMgr Command Shell.

Saturday, September 13, 2008

OpsMgr Command Shell tip: where-object vs criteria

I've seen a few OpsMgr Command Shell users posting scripts that use the get-alert cmdlet.

I've seen a few references, where people are using the format:
get-alert|where-object{some_criteria}

When this format is used, get-alert retrieves *all* the alerts from the OpsMgr database, and leaves PowerShell to do all the work of handling all the objects that come in, and then where-object also causes more PowerShell processing time to handle all of the objects passed from get-alert.

Although this may work fine, and a larger environment, this approach will take longer to finish this particular pipeline.

Compare the above format to:
get-alert -criteria 'some_criteria'

I had recently mentioned this in a TechNet Magazine article I wrote. Now if you don't believe me... I'll quote a recent microsoft.public.opsmgr.powershell post by Boris Yanushpolsky a Program Manager on the Microsoft OpsMgr team:

"Using the criteria is significantly more efficient as the query is handled by SQL and only the instances/alerts which meet the criteria are returned to PS. Here is a link to an MSDN article which explains the syntax:

http://msdn.microsoft.com/en-us/library/bb437603.aspx"

The syntax and case used for the query can be a bit harder to master, but it is worth the effort to learn it in larger environment.

Wednesday, July 2, 2008

TechNet Magazine article: Windows PowerShell in System Center Operations Manager

The article I wrote is now ONLINE! HERE.

Many thanks to the magazine editor and Roger Sprague from the Microsoft OpsMgr team for helping put this together and making it through the editing process. The article also gives credit to everyone that helped out including Pete Zerger (MOM MVP). Also, a special thanks to Stefan Stranger from Microsoft also, who blogged about the article HERE.

Check it out! It compliments some recorded sessions I recently did HERE.

Monday, June 30, 2008

Operations Manager 2007 and PowerShell recording

I did a presentation on Operations Manager 2007 and PowerShell, aka Command Shell for the System Center Virtual User Group's inaugural meeting announced HERE.

Here's is the roughly 50 minutes session that I did HERE (75MB/49 minutes 36 seconds).

Now, I've split up the recording into smaller sections for individual downloading:
1. Introducing myself (0.7MB/30 seconds).
2. General introduction to Windows PowerShell (14MB/8 minutes).
3. My upcoming TechNet article on Operations Manager and PowerShell (2MB/ 1 minute 35 seconds).
4. Operations Manager Command Shell (34MB/18 minutes).
5. A brief discussion of objects in .NET (12MB/7 minutes 22 seconds)
6. Customizing Operations Manager alerts (13MB/5 minutes 42 seconds).
7. Creating Command Shell scripts (2.5MB/1 minute 13 seconds).
8. Creating custom Command Shell reports (2.7MB/2 minutes).
9. Getting Command Shell help (1.5MB/1 minute 12 seconds).

Please don't hesitate to leave comments. I really appreciate them!