Archive for the 'OpsMgr' Category

PowerPack for non-Windows management in SCCM and SCOM

Quest loves PowerShell and many Quest teams have implemented powershell interfaces to their IT management products – I from my side am obviously willing to promote and encourage these efforts.

Our Quest Management Xtensions team is in charge of over 400 (!) extensions to Microsoft Systems Center, letting you use Operations Manager, Configuration Manager, and Opalis with variety of non-Microsoft platforms.

And today I am excited to announce that this team released a PowerPack for their tool! So not only can you get more out of your Systems Center tools, you can also now get extensible alternative user interface to the tools, and can further automate various operations with PowerShell.

You can learn more about Management Xtensions and download them here, and the PowerPack here.

Monitor web-site availability

Did you know that you can use PowerShell to monitor your website and send you alarms when something goes wrong? We had availability issues with our community site and I was quite surprised that the 20-line (!) PowerShell script did the job!

Basically, all I had to do was use the Net.WebClient object and its DownloadString method to query the page (with some proxy handling code I got from Alexey Chuikov), and trap any exception which it generates when something goes wrong. The trap is using our internal relay server to send me and everyone who is involved in the site administration the email.

Here’s the code:

##########################################################
# Test-Site - script to test web site availability
# and notify in case of any issues
# (c) Dmitry Sotnikov
# https://dmitrysotnikov.wordpress.com
##########################################################

function Test-Site {
    param($URL)
    trap{
        "Failed. Details: $($_.Exception)"
        $emailFrom = "my.email@address.com"
        # Use commas for multiple addresses
        $emailTo = "my.email@address.com,another.admin@address.com"
        $subject = "PowerGUI.org down"
        $body = "PowerGUI web site is down. Details: $($_.Exception)"
        $smtpServer = "smtp.server.to.use.for.relay"
        $smtp = new-object Net.Mail.SmtpClient($smtpServer)
        $smtp.Send($emailFrom, $emailTo, $subject, $body)    
        exit 1
    }
    $webclient = New-Object Net.WebClient
    # The next 5 lines are required if your network has a proxy server
    $webclient.Credentials = [System.Net.CredentialCache]::DefaultCredentials
    if($webclient.Proxy -ne $null)     {
        $webclient.Proxy.Credentials = `
                [System.Net.CredentialCache]::DefaultNetworkCredentials
    }
    # This is the main call
    $webclient.DownloadString($URL) | Out-Null
} 

Test-Site "http://powergui.org"

To test it you can obviously just put an invalid URL into the call.

Once I had the script running, I just set up a scheduled task in Windows Task Scheduler to run the script every 15 minutes:
Windows Task Scheduler with a PowerShell task

One trick I learned from MoW and used in the task, was using the -command parameter (rather than just supplying the script) and including the exit $LASTEXITCODE into the command, so the exit code from the PowerShell script gets registered as the scheduled task result.

So here’s the command-line I have scheduled:

c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Noninteractive -command ". c:\scripts\test-site.ps1; exit $LASTEXITCODE"

Works flawlessly! And can save you tons of money on a monitoring solution. Talk about ROI from learning PowerShell! 😉

Tags: , , , , , , , ,

PowerShell Adoption by Platform

I have always wondered how much is PowerShell adopted across various administrative tasks. Now I finally found the stats.
Windows Server and Active Directory are far ahead, with Windows Desktop being a runner-up, Exchange on distant 3rd and everything else far behind.

PowerShell use survey statistics by application and platform

My take on the data:

  • Server and AD management tasks are far ahead of everything else. Too bad the survey didn’t distinguish between the two.
  • It is a bit surprising the desktops took number 2. My guess is that respondents just meant using PowerShell on their desktop for their personal needs. Despite existing 3rd-party solutions I doubt PowerShell v1 can be used that widely for mass desktop management. I think we will need to wait for v2 and remoting to see this taking off.
  • Not surprisingly almost a 3rd of respondents are not using PowerShell for admin tasks at all. After all, there is some learning curve involved here and PowerShell is not yet available for any platform.
  • Almost a quarter of PowerShell users employ it for Exchange 2007. A very good result! After all, Exchange 2007 was released not that long ago, and has just got its SP1.
  • In general, it looks like platforms with no cmdlets available don’t really get PowerShell fans. .NET can be used to manage SQL and SharePoint – but look how much behind are they! Exchange 2003 can actually be managed with PowerShell, but there are no native cmdlets built-in – and as result PowerShell use is just 1.5%. Compare that to 23.4% Exchange 2007 got!
  • I wonder why Operations Manager is relatively low. Less adopted than Exchange 2007? OpsMgr admins less willing to script? OpsMgr tasks not really requiring scripting and command-line use?

The survey was carried out by Quest Software and took place in the very end of December 2007 and early January 2008. It was promoted at PowerGUI.org, this blog, myITForum.com and a few other PowerShell blogs. About 200 people responded. The exact question was: “Select the systems you are currently managing with Windows PowerShell“.

Tags: , , , , , , ,

Changing OpsMgr UI

Right after I blogged yesterday about the value of UI customization I came across this post by Ian Blyth on how Systems Center Operations Manager console only allows you to set the agent proxy one server at a time. Ian writes how painful it is to manage multiple servers and how he has to use workarounds such as command-line or a separate utility by Boris Yanushpolsky (a friend of mine by the way: hello Boris! ;))

In the end of the post Ian mentions that he only hopes OpsMgr SP1 will bring the change.

By the way, thanks to Rob, PowerGUI already has a pack for Operations Manager which provides for bulk operations and is fully extensible so you can have UI for proxy agent management and much more without waiting for Microsoft to provide every possible option you need in some SP.

Will that help you, Ian?

Tags: , , , , , , , , , ,


My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

December 2019
M T W T F S S
« Oct    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

%d bloggers like this: