Monday, July 14, 2008

SCOM Alert Description

A list of custom properties for alert description and notification:
For event Rules:

EventDisplayNumber (Event ID): $Data/EventDisplayNumber$ EventDescription (Description): $Data/EventDescription$ Publisher Name (Event Source): $Data/PublisherName$
EventCategory: $Data/EventCategory$ LoggingComputer: $Data/LoggingComputer$
EventLevel: $Data/EventLevel$
Channel: $Data/Channel$ UserName: $Data/UserName$
EventNumber: $Data/EventNumber$

For event Monitors:

EventDisplayNumber (Event ID): $Data/Context/EventDisplayNumber$ EventDescription (Description): $Data/Context/EventDescription$ Publisher Name (Event Source): $Data/Context/PublisherName$
EventCategory: $Data/Context/EventCategory$ LoggingComputer: $Data/Context/LoggingComputer$
EventLevel: $Data/Context/EventLevel$
Channel: $Data/Context/Channel$ UserName: $Data/Context/UserName$
EventNumber: $Data/Context/EventNumber$

The full list here:
http://blogs.technet.com/kevinholman/archive/2007/12/12/adding-custom-information-to-alert-descriptions-and-notifications.aspx

Friday, July 11, 2008

SCOM Rule based notifications

Whilst SCOM can handle a more granular rule/monitor based notification, it currently cannot be done through the UI. Deploy the following code to acomplish that:
http://blogs.msdn.com/jakuboleksy/archive/2007/01/18/notification-subscriptions.aspx
or a powershell veriosn of the same:
http://code4ward.net/cs2/blogs/code4ward/archive/2007/09/19/set-notificationforalert.aspx

Thursday, July 3, 2008

SCOM Script Maintenance Mode

Powershell scripts to schedule a computer, or a group to maintenance mode:
http://systemcenterforum.org/wp-content/uploads/CmdSchedMaint.zip

Tuesday, June 10, 2008

Developing workflow solutions

To start building workflow solutions on SharePoint read the SharePoint Team Blog, the community forum and MSDN technical article by Daniel Odievich and Alireza Etemad Mazaheri.

Tuesday, June 3, 2008

Wednesday, May 28, 2008

Remote Dubuggin SharePoint

Created a share on my client machine on my C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger folder.
Then I remoted into the SharePoint server and mapped a drive to connect to the share on my client machine.
Open the mapped drive on the server and navigate down the folders to x86\msvsmon.exe and run it on the server through the share.
Once the remote debug monitor is running. Click on tools -> permissions to give the account your logged in as permissions to debug.
You will also need to deploy the PDB file generated by visual studio when it creates your assembly to the GAC as well on the server. You will need to copy via the command line utility or map a drive to it since it is not available through the folder structure in windows. the folder you have to copy the PDB file to is c:\windows\assembly\gac_msil\\__. You will need to replace the three place holders (identified with <>) with the appropiate names for your assembly. Once the PDB file is copied over to that folder location, you are ready to attach and debug
In visual studio, select attach to process from the debug menu
In the "Qualifier" text box enter the netbios name of the server that the remote debugging monitor is running. It should refresh the screen and connect to the remote debugging session on the server. You can verify by going to the server and looking at the remote debugging monitor to see who is connected.
I choose to change the types of code I will be attaching to. I used the "select..." button to remove TSQL from the list since it was causing issues and I wasn't debugging SQL anyway.
Select your process and happy debugging.

SharePoint Logging

Noticed that SharePoint wasnt putting anything into the log files, except :
"Tracing Service lost trace events" messages. This required a restart of the WSS Tracing service.

BTW need to figure out why the Central Admin Diagnostic Settings does not maintain the values of Event Throttling, and where it is saved.

Friday, May 23, 2008

Exchange 2007 and related Management Packs

Microsoft Exchange Server 2007 Management Pack for Operations Manager 2007
Microsoft Windows Server 2000/2003 DHCP Management Pack for Operations Manager 2007
Microsoft Windows Group Policy 2003 Management Pack for Operations Manager 2007

SCOM Monitoring Servers on Untrusted Domains

You can do it the easy way by deploying a gateway server on the untrusted domain, but then again you can always spend hours trying to manage certificates between individual agent machines and your RMS. The following scenario is if you wish to deploy certificates using standalone CA, so that your AD schema is left untouched. So it can also be used if you wish to monitor your clients servers and donot have access to their AD.

Prereq:
1. You have a CA authority that can issue you a standalone CA. If you donot have one, please create one using the following link:
http://technet2.microsoft.com/windowsserver/en/library/36d03e33-c9e8-4eca-b948-addab1e22c531033.mspx?mfr=true
2. Gateway Server can telnet into RMS server on port 5723
3. Both servers can resolve each other names, if not place an entry in the hosts file.

1) Install root CA
i)From the RMS open the certificate authority (see prereq 1)http://certificateserver/certsrv
ii)Click the Download a CA certificate, certificate chain, or CRL link.
iii)Click the Download CA certificate chain link.
iv) Save certnew.p7b locally
v) open mmc
vi) Once the MMC console is opened, click Add/Remove Snap-In, click Add, and then click on Certificates located in available Standalone Snap-ins.
vii) Click Computer account-> next
viii) Click Finish->Close
ix) Navigate to Trusted Root Certificate Authorities->Certificates
x) Click Import and point to certnew.p7b from step iv)
Repeat the same steps for Gateway Server

2)Install Client and Server certificates
i) From the RMS open the certificate authority (see prereq 1)http://certificateserver/certsrv
ii) Click the Request a Certificate link.
iii) Click the advanced certificate request link.
iv) Click Create and Submit a request to this CA link.
v) In the Name field, enter the FQDN of RMS.
vi) In the Type of Certificate Needed field, select Other.
vii) In the OID field, enter the following: 1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2
viii) Click the Mark keys as exportable check box.
ix) Click the Store certificate in the local computer certificate store check box.
x) Click Submit
xi) Since we are installing standalone CA certificates, log back to certificate server.
xii) in Certificate Authority, browse to Pending Request folder, and approve the requested certificate.
xiii) From the RMS open the certificate authority (see prereq 1)http://certificateserver/certsrv
xiv) Click view status of pending request. Click on the certificate and install it.
Repeat for gateway Server
3.Tell SCOM to use certif on RMS
i) open mmc
ii) Once the MMC console is opened, click Add/Remove Snap-In, click Add, and then click on Certificates located in available Standalone Snap-ins.
iii) Click Computer account-> next
iv) Click Finish->Close
v) In the Certificate Tree on the left hand side, click Personal and the click Certificates.
vi) Right click on the certificate and Export
vii) Export with "Yes, export the private key", and select "Personal Information Exchange – PKCS #12" format.
viii) Save it locally as cert.pfx (give it a password if it asks for one)
ix) open cmd
x) browse to the directory containing momcertimport.exe
xi) type the command momcertimport.exe "certpath", where certpath is where cert.pfx was stored in step
xii). type the password entered in the previous step
xiii) Restart the health service
4. Approve the Gateway Server
i) Open cmd
ii)Browse to folder containing the gateway approval tool GatewayApprovalTool.exe
iii) run the following command:
Microsoft.EnterpriseManagement.GatewayApprovalTool.exe /ManagementServerName=scomsvr02.fightclub.local /GatewayName=scomsvr01.untrusted.local /Action=Create
5.Install gateway Server
i) To start the install process for the Operations Manager 2007 Gateway Service, run MOMGateway.msi in the \Gateway\i386 folder of the OpsMgr2007 distribution on the gateway server.
ii) Enter the Management Group Name, Management Server, and Management Server Port.
iii) Enter the gateway Action Account, best to keep a local untrusted domain account especially for this purpose. This account should have local administration rights on the Gateway Server.
6.Import Certificate on the gateway Server
i) open mmc
ii) Once the MMC console is opened, click Add/Remove Snap-In, click Add, and then click on Certificates located in available Standalone Snap-ins.
iii) Click Computer account-> next
iv) Click Finish->Close
v) In the Certificate Tree on the left hand side, click Personal and the click Certificates.
vi) Right click on the certificate and Export
vii) Export with "Yes, export the private key", and select "Personal Information Exchange – PKCS #12" format.
viii) Save it locally as cert.pfx (give it a password if it asks for one)
ix) open cmd
x) browse to the directory containing momcertimport.exe
xi) type the command momcertimport.exe "certpath", where certpath is where cert.pfx was stored in step
xii). type the password entered in the previous step
xiii) Restart the health service

Thats it, all done. Check the health on the RMS console (it takes a while for it to show as healthy). If it does not check event log on Gateway Server and RMS Server

Thursday, April 3, 2008

Dispose SPSite & SPWeb

SPSite & SPWeb implements the IDisposable interface, and hence must be explicitly disposed after use to avoid memory leaks. A must read blog on the subject:
Roger Lamb's SharePoint Developer Blog - SharePoint 2007 and WSS 3.0 Dispose Patterns by Example

Monday, March 17, 2008

Free Controls List

Shall update this, whenever I find a good control to use..

Great controls to be aware of when building SharePoint sites

Tool to recover lost partitions

TestDisk; An open source to recover lost partitions, worth a dekho.

TestDisk can :

Fix partition table, recover deleted partition
Recover FAT32 boot sector from its backup
Rebuild FAT12/FAT16/FAT32 boot sector
Fix FAT tables
Rebuild NTFS boot sector
Recover NTFS boot sector from its backup
Fix MFT using MFT mirror
Locate ext2/ext3 Backup SuperBlock

Thursday, March 13, 2008

Protecting SharePoint customisation against SP's, hotfixes, et all

Changes to 12 Hive
Changes directly to the out-of-the-box files in the 12 hive, should be avoided whenever possible. The reason being, you risk losing those customisations whenever a service pack/hotfix is applied. And always backup the 12 hive, so that it can be restored if it all goes pear shaped. And use a good diff tool to check for changes, and merge (as against replacing) when copying the backed up file into the 12 hive.

Whenever possible deploy our customisation as features and solutions. And follow the MS best practice guideline for keeping you customisation upgrade safe. To build a comprehensive customisation policy document read policies around development and customizations.

Changes to the SharePoint DB
MS does not support modification to the SharePoint DB. If you do have to make changes, keep a backup of DB which does not contain any customisation. MS will ask you to revert back to that DB, if you ever need to lodge a disaster recovery case with them. Changes to the following are not supported:
  • Adding database triggers
  • Adding new indexes or changing existing indexes within tables
  • Adding, changing, or deleting any primary or foreign key relationships
  • Changing or deleting existing stored procedures
  • Adding new stored procedures
  • Running stored procedures manually or programmatically
  • Adding, changing, or deleting any data in any table of any of the databases for the products that are listed in the "Applies to" section
  • Adding, changing, or deleting any columns in any table of any of the databases for the products that are listed in the "Applies to" section
  • Any modification to the database schema
  • Adding tables to any of the databases for the products that are listed in the "Applies to" section
Read this article on what is supported, which basically includes DB maintenance tasks only. If you have to query SharePoint DB, I suggest you do so against a copy of the production data, and build maintenance plans to keep it in synch with prod data. Maintenance plans though can cause issues in themselves, such as index corruption as described here .

Friday, March 7, 2008

SCOM Training Videos

Can be found here

SCOM Documentation

The documentation is available here and covers:


  • Operations Manager 2007 Deployment Guide
  • Active Directory Management Pack Guide for Operations Manager 2007
  • Exchange Management Pack Guide for Operations Manager 2007
  • SQL Management Pack Guide for Operations Manager 2007
  • Windows Server Operating System Management Pack Guide for Operations Manager 2007
  • Windows Client Operating System Management Pack Guide
  • Operations Manager 2007 Terminal Services Management Pack
  • Operations Manager 2007 Security Guide
  • Operations Manager 2007 Management Pack Guide
  • Operations Manager 2007 Management Pack Terminal Services
  • Operations Manager 2007 Microsoft Management Pack Authoring Guide

The 180 days Trial version is available here.

Newsgroups :

  • microsoft.public.opsmgr.acs
  • microsoft.public.opsmgr.ad
  • microsoft.public.opsmgr.aem
  • microsoft.public.opsmgr.authoring
  • microsoft.public.opsmgr.docs
  • microsoft.public.opsgmr.exchange
  • microsoft.public.opsmgr.general
  • microsoft.public.opsmgr.iis
  • microsoft.public.opsmgr.managementpacks
  • microsoft.public.opsmgr.powershell
  • microsoft.public.opsmgr.reporting
  • microsoft.public.opsmgr.sdk
  • microsoft.public.opsmgr.setup
  • microsoft.public.opsmgr.sql
  • microsoft.public.opsmgr.ui

Other resources:

Wednesday, March 5, 2008

Recreating Orphan References

Background info:

What we are essentially trying to do here is recreating the reference between ConfigDB.sitemap.ID and ContentDB.Webs.SiteID, to get rid of Orphans. In most cases this is left best for Sharepoint to do (through detaching-attaching the content DB). This creates the reference if none exist. Manually updating the references will corrupt the indexed content on these sites and search may not work.

Note: Please backup ContentDB & Config DB before even firing a query on these. Also do so after hrs, as you may lockup these tables.

Issue with multiple sites with same URL in the farm:

One of the issues we had, was that multiple sites existed with the same URL. So if users type that URL, Sharepoint has no way to uniquely identify the site being referenced. For this very reason detach-attach also does not work, nor does other stsadm tools like databaserepair (it will give you zarro results). We would need to fix this issue before trying to proceed further into recreating references.


Run the stored proc :

create proc dbo.proc_GetOrphanedSites
as
Drop table orphanlist
CREATE TABLE [dbo].[orphanlist]( [farm] [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [databasename] [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [SiteID] [uniqueidentifier] NULL, [sitepath] [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [type] [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL)
drop table orphan_hopper declare @dbname as varchar(250), @cmdstr as varchar(2000), @dbid as varchar(250),@configdb as varchar(250) /** only change the following line and nothing else, change spskills_config_db to your config db name **/select @configdb = 'Sharepoint_Config'
/** Change nothing below this line **/select @cmdstr = 'select distinct b.name as ''databasename'', b.id as ''dbid'' into orphan_hopper from [' + @configdb + '].dbo.sitemap as a inner join [' + @configdb + '].dbo.objects as b on a.databaseid=b.id inner join [' + @configdb + '].dbo.objects as c on c.id=a.applicationid inner join [' + @configdb + '].dbo.objects as d on b.parentid=d.id inner join [' + @configdb + '].dbo.objects as e on d.parentid=e.id ' exec (@cmdstr) DECLARE DBCursor CURSOR For Select databasename, dbid From orphan_hopper OPEN DBCursor FETCH NEXT FROM DBCursor into @DBName, @dbid WHILE @@FETCH_STATUS =0 BEGIN INSERT INTO orphanlist([Type], farm, databasename,[sitepath], SiteID) EXEC (' select ''Potential ConfigDB orphan:'' + '''+@dbname+''' as [Type], '''+@configdb+''' as [farm], '''+@dbname+''' as [databasename],path as [sitepath], id as [SiteID] from ['+@configdb+'].dbo.sitemap where id not in (select id from ['+@dbname+'].dbo.sites) and databaseid = '''+@dbid+''' union select ''Potential ConfigDB orphan:'' + '''+@dbname+''' as [Type], '''+@configdb+''' as [farm], '''+@dbname+''' as [databasename],path as [sitepath], id as [SiteID] from ['+@configdb+'].dbo.sitemap where id not in (select siteid from ['+@dbname+'].dbo.webs where parentwebid is null) and databaseid = '''+@dbid+''' union select ''Potential ContentDB orphans:'' + '''+@dbname+''' as [Type], '''+@configdb+''' as [farm], '''+@dbname+''' as [databasename],fullurl as [sitepath], siteid as [SiteID] from ['+@dbname+'].dbo.webs where parentwebid is null and siteid not in (select id from ['+@configdb+'].dbo.sitemap where databaseid = '''+@dbid+''') union select ''Potential ContentDB orphan:'' + '''+@dbname+''' as [Type], '''+@configdb+''' as [farm], '''+@dbname+''' as [databasename],fullurl as [sitepath], siteid as [SiteID] from ['+@dbname+'].dbo.webs where parentwebid is null and siteid not in (select id from ['+@dbname+'].dbo.sites) ') FETCH NEXT FROM DBCursor into @DBName, @dbid END CLOSE DBCursor DEALLOCATE DBCursor select * from orphanlist

GO

· If there are no duplicates (URL’s) then all you need to do is attach/detach the content db (use stsadm for this, as you may experience script timeouts if you try it through CA-UI)

· If there are duplicates but belong to different databases, then you need to restore the site collections on a different path (stsadm). And then detach-attach the databases one by one.

· If they all happen to reside in the same database, then either we need to change the path associated with each of them, or figure out the one you need to restore and delete the rest (Query Analyser). Then detach-attach the content DB.
No techie it seems is worth his for loop without a blog, however I start this more as a tool to collect information for future reference.