Blog
Archive
<October 2008>
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
Monthly
Go
Search
  |  
Author: Created: Tuesday, September 09, 2008 1:58:59 PM RssIcon
News and updates about code4ward.net
By Stefan Koell on Tuesday, October 21, 2008 10:11:17 PM

I got a lot of feedback lately, that Royal TS needs an import functionality. I completely agree, but I soon realized, that almost everyone has different requirements. So thinking through all possibilities and providing a powerful UI which can handle all different requirements would be very time consuming.

So I thought, providing a sample script which shows how this can be done should get you started...

Click here to get to the script.

By Stefan Koell on Tuesday, October 21, 2008 9:23:56 PM

As most of you already saw, code4ward got a complete new face. Here some facts about the relaunch:

  • Join The DotNetNuke Powered! ProgramThe new web page runs on the DotNetNuke platform. I never was a huge fan of DotNetNuke and if I could, I would still try to avoid using it. Don't get me wrong, I think it's a great platform with a great value and a huge and very professional community attached. I just really don't like dependencies...
  • The skin is a professional one, which was bought and customized. I am really happy with the look of the site.
  • Some of the graphics were made by a friend of mine who is a very talented designer with fresh and crazy ideas. Thanks Armin! Some other graphics came from iStockPhotos
  • The previous site (based on Community Server) was hosted on a machine at my place. My bad experience with my (lately very unstable) ISP forced me to move the site somewhere else. A friend of mine (Netmonic) offered me to host my virtual machine for a very low monthly rate. So in fact, this is quite new: Now I not only have to pay for power and an internet connection, I also must pay for hosting; not much but still.
  • The web site is now hosted on a Windows 2008 / IIS 7 machine running SQL Server 2008. Was quite a learning experience.
  • The download tracking and statistics code was self written. It's a C# HTTP Module using LINQ. I will soon release the code for that.
By Stefan Koell on Thursday, September 25, 2008 12:05:05 PM

ComponentFactory is offering their Krypton Suite (Value: $299) for free to MVPs and .NET bloggers. Go, ckeck it out here: http://www.componentfactory.com/blog/?p=328

By Stefan Koell on Thursday, February 28, 2008 7:35:37 AM

CheckServiceState Script CheckServiceState Script

If you ever wanted more control how to monitor windows services with Operations Manager 2007 you most likely realized, that you have to do it all by yourself with a custom script.

I had at least two major problems which forced me to use a custom script:

  • It seems that you cannot monitor the status of a service which has the startup type set to "Manual". (There is a parameter in the overrides dialog called "Alert only if service startup type is automatic" but it doesn't have any effect, the health state simply doesn't change)
  • When using templates to monitor a windows service you cannot override the monitor to only monitor a subset of services using a group. The group just doesn't show up in the list

So this is my approach to windows service monitoring:

First of all, let's set up a Windows Service monitoring using the standard Management Pack Templates Wizard. In this example: "Print Spooler". In the monitoring wizard select or create a destination management pack, here: "Windows Service Monitoring".

I use the template wizard because I can use the discovered service class to target my own script and I get all the other goodies (performance monitors, baseline rules, etc).

After a while the service you just configured to monitor will be discovered. Now let's setup a group:
Create a new group with a name like "Print Spooler Service Group" in the "Windows Service Monitoring" management pack. In this example I use explicit group members but you can also use dynamic membership of course. The beauty is, that your group can (and should) contain the discovered service instances:
bws1

Next, bring up the monitors the template wizard creates for us:
bws2

There you should see the (very inflexible and buggy) availability monitor:

bws3 

Right-click on the "Service Running State" monitor and select "Overrides > Override the Monitor > For all objects of type: Print Spooler". In the Override Properties, disable the monitor (check "Override" for the Parameter Name "Enabled" and change the "Override Setting" to "False").

Next, right-click on the "Availability" node and select "Create a monitor > Unit Monitor...". In the unit monitor dialog, select the "Scripting > Generic > Timed Script Two State Monitor" as monitor type and place it in the same Management Pack "Windows Service Monitoring".

In the General properties page we can now target the script to the "Print Spooler" class. Also be sure to disable the monitor by default (We enable it later using a group override).
bws4

Pick a schedule which makes sense to you (I recommend every 5 minutes but depending on your environment I suggest that you don't go below 2 minutes).

In the Script page, provide a script name, like CheckServiceState.vbs and paste the attached script into the script area.

The script takes 3 parameters (documented in the script) but for a standard scenario you can just use:
"$Target/Property[Type="MicrosoftSystemCenterNTServiceLibrary!Microsoft.SystemCenter.NTService"]/DisplayName$" "Running" "Auto"

Because we already target the print spooler class we can use a dynamic parameter to pass on the service name. Parameter 2 and 3 (which is optional) can be used to define the desired status and startup type. Please be sure to encapsulate each parameter in double-quotes - just to be on the safe side.

Next let's define the health expressions:
bws5 
bws6 
bws7

And finally the alert:
bws8

I suggest an alert description like:
The state of the monitored service '$Target/Property[Type="MicrosoftSystemCenterNTServiceLibrary!Microsoft.SystemCenter.NTService"]/DisplayName$' on '$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$' is invalid: $Data/Context/Property[@Name='AlertText']$

After you created your monitor, enable it using an override for the group we created earlier.

As last (optional) step I suggest to create a state view containing the Print Spooler instances and scoped to the group where we enabled the monitor.
bws9

Of course, it would be much better if that functionality and flexibility is provided by OpsMgr out of the box...

cheers

By Stefan Koell on Tuesday, December 18, 2007 3:00:37 AM

Once again, a little post to share with you guys about Operations Manager Tasks - this time using Powershell. First a little background story: Current version of Operations Manager 2007 (SP1RC) has still some nasty bugs and it seems that especially the events view doesn't get much attention from the product team.

The event view doesn't HTML-Encode the event description in the details pane. Which is bad if you have to look at events (published exceptions for example) with fragments of XML or HTML included. This information just doesn't appear in the preview pane.

So, the first thing which came to my mind is: Ok, then. How about some kind of console task which executes a quick Powershell command to dump out the event details using the Get-Event Cmd-Let.

Next Problem: You can create an event task and put a dynamic parameter $ID$ in it. However, starting the task using the actions pane on the right always passes the same ID (I guess the ID from the first event selected when the view gets loaded) to the task - regardless which event was selected!

Lucky me, there is a workaround: When you execute the task using the Actions menu in the console, the task will always get the ID from the selected event.

So, now the interesting stuff: How to setup such a task?

  • First create a console task for events using the authoring section in the console.
  • When defining the command, set the application to: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe
  • Set the parameter to: -PSConsoleFile Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1 -NoExit .\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1;Get-Event -Id $ID$
  • Set the working directory to: C:\Program Files\System Center Operations Manager 2007
  • Finally, uncheck the "Display output when the task is run" checkbox

That's it. Enjoy...

By Stefan Koell on Wednesday, September 19, 2007 2:43:37 AM

In MOM 2005 it was easy to notify someone on specific alerts. SCOM 2007 - with it's subscription based system - cannot handle these kind of notifications. But the limitation is the user interface. Jakub from the SCOM 2007 product team released some very useful code which helped to implement a notification based on the alert name. One problem of Jakubs code is, that it's a C# program which is not very handy and that he creates most of the stuff in code which can be created with the UI.

I translated the script to power shell, which should be much friendlier to use, deploy and let's you quickly tweak some settings. The code below works for me (at least working with email notifications), but I have to admit, I didn't test it that much. The script usage is pretty simple, but you have to do some stuff first:

  • Setup email notification
  • Create at least one recipient
  • The alert has to be raised at least once
  • Change the $RMS variable in the script to your root management server

Then, just execute it in Power Shell: ".C:\Set-NotificationForAlert.ps1 "This is a test alert" "This is a test notification recipient"

Parameter 1: The name of the alert

Parameter 2: The name of the recipient

So, hopefully I can ease some pain with this...

File

 Set-NotificationForAlert.ps1

By Stefan Koell on Thursday, May 03, 2007 6:08:37 AM

Someone might ask: why the heck do I need that? And yes, I never thought that I will need it but I learned that in SCOM 2007 a group is not always a group.

Jakub Oleksy helped me to understand and solve my problem and I am happy to share this information with you.

The problem is, that groups created by the web application wizard can not be tweaked using the UI in SCOM 2007. It's not possible to create a dynamic membership rule. It's also not possible to assign a subgroup to such a group. So having a lot of servers and a lot of web applications it's not really fun to pick every single server in every single web application.

Here my workaround:

  • Create a web application using the wizard
    A group named after your web application with the suffix "watcher computers group" will be created
  • Create your own computer group using the UI and define a dynamic membership rule
  • Configure the script (the 3 lines at the beginning) and test (DO NOT RUN THIS UNTESTED IN PRODUCTION ENVIRONMENT!)

This is just a proof-of-concept script to show how you can do stuff like this. According to Jakub there may be a fix in SP1 which enables you to utilize the group created by the web application wizard in a way to either create a dynamic membership rule or attaching a subgroup, or both.

Disclaimer:
USE THIS AT YOUR OWN RISK. I AM NOT RESPONSIBLE FOR ANY DAMAGE THIS SCRIPT MAY CAUSE. THAT SAID, HAVE FUN!

File Source Code

By Stefan Koell on Tuesday, April 24, 2007 11:08:37 AM

During the deployment of System Center Operations Manager 2007 we realized that the database is not supported on Itanium (IA64) hardware. This was a big issue for us, because we only had IA64 hardware for our database machines. So a sick idea came to our minds: just install it on a temporary x86 or x64 machine - with the exact same machine name as the final IA64 production machine, detach the database and move it to the IA64 and re-attach it there.

After that, you have to ensure that the broker function is enabled on the DB. To do so, execute the following query in the SQL management studio (assuming you named the database 'OperationsManager':
SELECT is_broker_enabled FROM sys.databases WHERE name='OperationsManager'

This should return '1'. If not fire up the following statement (again, assuming the database is named 'OperationsManager':
ALTER DATABASE OperationsManager SET ENABLE_BROKER 

If the service broker is not enabled you might get errors or hangs during discoveries and submitting tasks. 

So far this is working great for us, it's still not clear if a setup like this is supported by Microsoft. But there really should be no difference running the DB on a IA64 instead of running it on a x64. No binaries are installed by the setup, only the database schema is created. As far as I know, Microsoft is working on IA64 support for the database - maybe a Service Pack 1 thing...

Update:

You also have to be sure that the CLR (.NET Common Language Runtime) for stored procedures is enabled. To do so:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE
WITH OVERRIDE;
GO

By Stefan Koell on Tuesday, April 10, 2007 12:34:37 PM

firefox_about_configI use a lot of different browsers on my systems. I am using Safari on the Mac and Internet Explorer on Windows - and of course most of the other available browsers like Camino, Opera and Firefox. My favorite is Firefox. One simple reason is the huge amount of available plug-ins and extensions which are handy for daily browsing and of course for development purposes.

Another great thing about Firefox is customization. Ever tried to put “about:config” in the URL box? Doing so enables you to change a lot of settings where no GUI is available. In fact that’s the GUI for managing  Firefox’ “registry”. One thing which was bothering me all the time about Firefox was the automatic image resize to fit in the window.

Fire up Firefox. Enter “about:config” and just change the value of “browser.enable_automatic_image_resizing” to false. That’s it. 

You can find some useful tips on the How-To-Geek blog like the one above or on how to disable tab scrolling and much more.

By Stefan Koell on Friday, March 23, 2007 3:55:37 PM

James Henry blogged about how to enable PDF indexing in Sharepoint:

Here are best instructions for properly configuring SharePoint to search PDF documents and view the file type icon in a document library. This involves installing the Adobe PDF IFilter 6.0 on each SharePoint 2007 front end web server. You would also need to do this on the Search Server, if you have split this up in your environment.

Perform the following steps for either Windows SharePoint Services v3 (WSS v3) and Microsoft SharePoint Server 2007 (MOSS 2007).

  • Download Adobe PDF IFilter 6.0
  • Stop the IIS Admin service: Start -> Run -> services.msc -> IIS Admin Service -> Stop
  • Run the Adobe PDF IFilter 6.0 Setup program to install the filter on the server
  • Copy the ICPDF.GIF file (ICPDF – right click and save as) to "[Hard_Drive]:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images"
  • Edit the file "[Hard_Drive]:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml\DOCICON.XML"
    1. Add an entry for the .pdf extension.
  • Perform an iisreset by performing the following: Start -> Run -> iisreset. You could also recycle the SharePoint Application Pools in Internet Information Services Manager

For MOSS 2007, perform the following additional steps

  • If you have MOSS 2007 and have enabled Shared Services then, goto Central Administration -> Shared Services Administration -> Select your current Shared Services Provider -> Search -> Search Settings -> File types
  • Click on the "New File Type" button
  • Add the "pdf" file extension in the designated text box and click on the "OK" button
  • Go back to the Search Settings page
  • Click on the "Content sources and crawl schedules" link
  • Select the content source, access its context menu, and click on "Start Full Crawl"

I use Sharepoint Services V3 and installed the PDF IFilter after I uploaded hundreds of PDFs. This was bad, because Sharepoint Services does not crawl these already uploaded documents until they are touched (modify a property or so). Since no GUI is available to do so like in MOSS you have to use stsadm.exe command which ships with sharepoint:

Change the directory to: Program Files\Common Files\Microsoft Shared\web server extensions\12\bin
Now execute: stsadm.exe -o spsearch -action fullcrawlstop
then: stsadm.exe –o spsearch -action fullcrawlstart