Run All SharePoint 2010 Health Analyzer Jobs Immediately

So, after you’ve set up your farm (Or even if you’ve only just upgraded or added a new WFE to the farm) it’s always interesting to see what Microsoft’s Health Analyzer has to say about the new configuration.  Now, we could just sit around and wait for each job to fire off thanks to the SharePoint Timer at various intervals and check periodically as the alerts are triggered, however, I’m more the kind of person who likes to get the bad news all at once.  This ends up giving me a nice little checklist of “Things I Need to Fix” for the day (ok, sometimes it takes more than a day).

Enter the power of PowerShell.  Using PS, we can look for a list of all SPTimerJobs that have the word “Health” in them, and pass that list of SPTimerJobs into the Start-SPTimerJob commandlet, which will fire off all our Health Analyzer checks in a relatively short time.  Here’s the code for PS:

#First load the SharePoint commands if not using the SharePoint PS Shell
Add-PSSnapin "Microsoft.SharePoint.Powershell"
#And now kick off all Health Timer Jobs
Get-SPTimerJob | Where {$_.Name -like "*Health*" -and $_.Name -like "*-all-*"} | Start-SPTimerJob

Organic Snail and Slug Pest Control

There are many ways of dealing effectively with garden pest snail and slug problems.

Encourage Natural Predators

Natural predators of snails and slugs are rats, frogs, birds, lizards (especially blue tongue lizards) and, perhaps most importantly – centipedes. Centipedes and Leopard Slugs (those enormous spotty ones) are the most important slug predators so don’t kill them!

Encourage them to stay in your garden by providing suitable habitat, such as rock lined ponds, prickly shrubs, logs, and nesting boxes.

Incorporate Farm Predators

Ducks, notably the Khaki Campbell, can clear a badly infested garden in a few months. However, they should be kept away from young plants that could be trampled by their webbed feet.


As a garden pest, snails are easier to capture than slugs. But timing is crucial. Snails are prolific breeders. So for best success you’ve got to nip snails in the bud before their breeding season gains too much momentum as the weather progresses from dry to moist.

One way is to get the jump on them by sussing out where they are likely to be spending the dry season (e.g. leafy, cool, shaded areas with lots of hiding places such as creeper covered walls and brick stacks) and giving it a massive soaking in late summer – enough to break dormancy by dissolving the seal snail’s form over their shell opening. Then mount an active trapping campaign.

Pop captured snails straight into a bucket of fresh slaked lime (hydralime).

Hand Picking

Any garden pest snail or slug (except for the big spotted Leopard Slugs which actually hunt down other slugs!) that I come across is marked for destruction. However, my favorite time for hunting is on wet dewy mornings.

As an early riser, I have noticed that snails come out in droves after a heavy downpour of rain. They are sitting ducks (it’s not hard to be faster than a snail!) and you can literally collect hundreds each time you do it. My chooks got thoroughly sick of them.

Anyone have any good recipes for escargot? This French delicacy is, after all, based on the common garden snail! I believe the snails need to be purged first by feeding on bran for a short time. Any ideas?


After rain, when conditions are snail friendly, place small mounds of fresh bran sweetened with a little castor sugar around the garden. Venture out a few hours after dark with a flashlight and harvest up the snails. Continue every night for a fortnight.

You could also put a little pile of this lure beside your new seedlings – with a bit of luck the snails will prefer it and leave your poor babies alone!

The little black slugs that are hard to catch by other methods, will find hollowed out grapefruit shells an irresistible lure. You could also give cabbage leaves and carrot skins a go to lure out both slugs and snails.


For easy movement, snails and slugs need a firm stable surface to glide over. Unstable surfaces such as fresh ash, soot, bark chips, gritty sand, fine sawdust, or dry crumbled egg shells tend to stick to their underside and hamper their progress considerably. garden pest snail

Sprinkle a band of fresh ash around your plot of young plants… Though you can’t keep snails and slugs away with these barriers, you can at least slow them down!

A mulch of oak leaves is also reported to be a good deterrent.

If the situation is desperate (and you have an acid soil anyway), you could also try fresh slaked lime. It is caustic and keeps them at bay for several days.

In some areas garden pest snail attacks are so bad that it’s hard to get young fruit trees established. In these cases placing a tire that has been painted inside with a strong copper sulfate solution around the tree is a long lasting deterrent.

Protect Vulnerable Plants

You can also protect vulnerable plants by covering them with clear plastic bottle halves.

Snail and Slug Traps

There are a variety of clever strategies you can use to trap pesky snails and slugs:

Habitat Traps

Snails like small hollows in cool places to hide in when the sun comes out. You can make habitats that attract snails, making it easier to hunt them down. For a short-lasting but irresistible snail palace, I have found a handful of cardboard toilet roll cylinders tied together with a rubber band effective. Put it in a shady, moist, cool place that’s easy to reach. You might also like to try a few bricks placed side by side 3 cm apart under an upturned cardboard box, or short lengths of PVC pipe off-cuts.

Beer Traps

Isn’t it annoying when you find a half finished stubby of beer that has long gone flat? Never fear! You can now put it to great use as slugs and snails love beer and they don’t care if it’s flat either. Just sink a wide jam jar into the ground so its rim is level with the soil surface, and fill it up with stale beer. Adding a little sugar (2 tablespoons to a liter of beer) makes the trap even more effective.

To stop it overflowing with water from rain or the sprinkler make a canopy out of the bottom of a plastic bottle (make sure you cut out some doors for the critters to get in). Garden pest snail and slug hordes will dive in and drown – what a way to go! You can use the trap over and over – just scoop out the dead and top it up now and pest snail

Biological Control

A microscopic nematode worm that preys on slugs is available commercially as sachets from organic gardening suppliers. They are simply watered into the soil and are effective for 6 weeks. garden

Out-Gridview: ObjectNotFound, NotSupportedException

I was playing with some PowerShell and wanted to use the Out-Gridview command that is part of CTP 2.0, but when trying to us it in my script I kept getting an error message that it wasn’t supported.  This command sends output to an interactive table in a separate window, a very useful function when dealing with large amounts of data that looks pretty nasty in a text only environment.

As it turns out, many of the product PowerShell hosts that are shipped are in fact minishells (such as the SQLPS shell) and not all commandlets are available including the OGV as you might expect in a normal PowerShell console.

Rule of thumb here is always use the Powershell windows and just use initialization scripts for the functions you want.

I generally get away from having to deal with minishell issues by always running the main PS shell and including this line in my \My Documents\WindowsPowershell\Profile.ps1 file, which autoloads the registered snap-ins of the computer I happen to open my PowerShell in:

get-pssnapin -registered | add-pssnapin -passthru

Beware of SharePoint Consultants in Sheep’s Clothing

Another soapbox post…

Seriously, if you’re hiring a consulting company or going offshore,  don’t just trust that they know how to develop SharePoint solutions that are portable and don’t suck.  What do I mean by that?  Last month we had some code delivered from offshore.  We did not specify that they should follow good SharePoint coding standards, so what we got was a system that worked, but was as about as far removed from what makes a good SharePoint solution as possible.  Things to tell the next development team should include:

  1. Do not update the out of box default master page through SharePoint designer.  For that matter, never update the default master page.  never never never.  You should always leave the out of box stuff alone.
    1. This also means no overwriting of OOB SharePoint files in the hive.
    2. If you must deploy to the hive, always use a sub-directory, never write to the root of the hive.
  2. Forget about .stp files.  For development deliverables they don’t exist and should never be in a deliverable.  Always set up site and list definitions in code.
  3. Any piece of code must always be delivered packaged in a .wsp, having a folder in the deliverables with an implementation note about where to copy the contents on the server?  NO!  Makes it a nightmare when you try to join another server to the farm.
  4. InfoPath forms – just a bad idea.  If you need a complex form just go with a custom ASPX form.  Easier to debug, easier to support, easier to upgrade.
  5. No SharePoint Designer created workflows.

If I had to do it over again, and I will, I’m going to make sure I ask for some samples of their previous work and at least have them walk me through some of their past deliverables to other customers and what sort of implementation instructions they have supplied.  Hopefully that will at least give me a sense of what sort of standards (or lack of good coding standards) it is that they follow.

Finally, beware of any company that will not send you their documented coding standards for SharePoint or just sends you a link to Microsoft’s website.