Your basic ITPro blog... What's going on at work, what I'm interested in.

Wednesday, January 28, 2009

Installing SQL Server 2008 Express Edition Management Studio

image I have a new VM that I am configuring as a development platform. I am installing some of the Visual Studio Express Edition tools, specifically Visual Web Developer 2008 EE and Visual C# 2008 EE. I’m not a developer, but I enjoy dabbling. This will give me the tools to do that.

I first installed Visual Web Developer (did this a week ago). As part of this install, it installed SQL Server 2008 Express Edition. While this installed the database engine, it did not install the SQL Server Management Studio (SSMS). Now, SSMS for version 2005 was a separate download and install. This version, however, is not able to manage a 2008 install. So, I went looking for the 2008 version of the SSMS. It turns out that there are multiple versions of the SQL Server 2008 EE product…

It looks like the WebDev install included only the Runtime version of SQL Server EE. So, if I wanted to get the Management Studio, I had to use one of the other two distros of this product. Here’s where the snag came that I wanted to share.

The install of the SQL Server 2008 Express with Tools allows you to install a new instance or add to an existing instance. My first thought was to add to an existing instance (as I already had an installation of this product). However, when I went through this step, it did not allow me to add the Management Studio. I think it saw that the currently-installed instance was the ‘Runtime Only’ version, so it did not offer me the Management Studio.

After wrestling with this for a few minutes, I decided I would just install a new instance, hoping to get access to the Management Studio that way. This worked even better than I wanted. I was able to select ONLY the Management Studio on the new instance install page. This page listed ‘Instance resources’ and ‘Shared resources’. Management Studio was under ‘Shared resources’. I selected it and left everything else unchecked.

Worked like a charm.

This wasn’t completely intuitive (you can’t add to an existing install if the existing install is the Runtime Only version). So, you have to use the ‘install a new instance’ option.

What’s Up with What’s Up Gold?!

imageI want to start by saying that I really like this product.  We are currently running What’s Up Gold (WUG) v12.3.1 to monitor over 100 devices on our network.  We are monitoring a combination of servers, switches, routers, websites, and more. Our implementation is not complete, but we are constantly adding to it; adding monitors, notification, etc. We are especially focusing on notification now. Currently, I have my WUG dashboard open on my second monitor throughout the day. So, I can see real-time performance of our systems. The BIG ‘killer-app’ feature for me is the history that WUG keeps for the metrics it monitors.

This has been especially useful when evaluating storage usage, bandwidth utilization, and CPU/memory usage on some of our high-load systems. We have caught things that would have become problems BEFORE they became problems. I feel like this tool has paid for itself in these scenarios! Also, we have recently been looking at the Windows NT Service monitor feature. This is cool. You can monitor services on machines and, if WUG sees that a service is stopped, can re-start it automatically. Very nice! This, combined with alerting, gives us good active monitoring and remediation capability. It’s always best to know about, and fix, a problem before your users have to report it to you. WUG makes this available.

With that all being said, I have to rail on some thing that I really DON’T like about What’s Up Gold. Like I said above, we are running version 12.3.1. You would think that a product as mature as this (in its 12th version) would be a bit more ‘enterprise’ friendly. I have had an experience over the past few weeks that has led me to a contrary opinion.

When installing WUG, you have the option of using a local ‘Express Edition’ SQL database or a full-blown SQL Server 2005 installation. We originally installed WUG on a machine and used a local DB. As you probably know, SQL Server Express Edition and a 4GB limit on its database size. Well, over time, our WUG database grew to 4GB and then promptly when ‘caput’! We had a choice… delete history or migrate the database. We have a SQL Server 2005 installation with capacity to spare, so our decision was to migrate the database.

Following the ‘Migration Guide’ from Ipswitch, I was able to move the database form the local SQL engine to our SQL Server. Everything seemed to be fine… until I tried to add another device to WUG. When I tried this, I got…

clip_image002

And, this is where things became very difficult. First, I have to state that I am not a DBA. But, I can find my way around the SQL Server Management tools, run queries, etc. Anyway, with this error in hand, I went where I always go when I have a question… Google. I also went to WUG’s website to search their KB. It was about this time that my frustration with WUG, specifically their help and technical support, really began to blossom. Their KB articles are very poorly written; much too vague and general. Any discussion threads I found related to this issue was just populated by frustrated users, not much in the way of constructive input on the part of WUG technicians.

I found a few vague references to ‘sp_dropserver’ and ‘sp_addserver’, but no real explanation of why or how I would use these to fix this particular problem. Nor was I able to find an actual explanation of the problem itself.

After a while of frustrating searching, I contacted WUG technical support and opened a ticket with them. I sent them a detailed description of the problem I was having and how it came about. I sent them the picture shown here so they would see exactly what I saw, hoping to get some… you know… support. Instead, I got the following e-mail in response:

-----------------------

Hello Derek,

   You will find the steps to resolve the issue in the migration guide:

http://www.whatsupgold.com/wugdbmg

  As with all SQL operations this should be performed by a SQL DBA.

----------------------

Helpful, huh? I can really see what they are paying these tech support guys for! Such great analysis! Such support! I had already used the Migration Guide to help with the original migration. Further, the error message references the ‘sp_addlinkedserver’ command, but the Migration Guide talks about the ‘sp_dropserver’ and ‘sp_addserver’ commands. I responded to tech support, indicating my concerns and issues I had with running these commands on my SQL Server. I let them know that I executed the commands and got an error, which I sent along. Their ‘oh-so-helpful’ response was:

-----------------------

Hello Derek,

   Please have your DBA execute the commands.

-----------------------

Yes, that was the full extent of their response. Never mind that I had said that I DID RUN THE COMMANDS! Never mind that I had reported that the commands generated an error. So, I again asked if they could please help explain the error and help me determine a solution to this problem. I reiterated that I ran the commands and got an error and that the problem was still not resolved.

Their response:

-----------------------

Hello Derek,

     Operation of WhatsUp Gold with a full SQL database should be done with the assistance of a qualified DBA. Ipswitch does not provide these services. Our partners can provide services in such areas.

http://www.whatsupgold.com/partners/index.aspx

-----------------------

Nice, huh?! Was I asking them to provide ‘qualified DBA’ services?! No, I was not! I was asking them to tell me why THEIR PRODUCT wasn’t working. The fact that THEIR PRODUCT uses a database server should not preclude them from having to provide support if the problem involves the database! This was ridiculous. This clown wasn’t even TRYING to help. And, he never did, I am sad to say.

So, it took more research, trial-and-error, and a bit of luck, to find a solution to this problem. The various posts, KB articles (from Ipswitch and Microsoft), and other resources all hinted at parts of the problem. But, Ipswitch should have definitive support for this problem. The fact that they don’t and are not helpful is deplorable.

So, we will continue to use What’s Up Gold… But, I can’t imagine a scenario where I would actually try to use their tech support services again… They are completely worthless! I have been in this industry to 20 years or so and they ‘provided’, without exception, the worst service I have ever experienced.

Thursday, January 15, 2009

Setting up SNMP on Windows Server 2008

Had an odd little ditty today…

image I needed to set up SNMP on a Windows Server 2008 box so that I could add it to our What’s Up Gold monitoring system. As you probably know, Server 2008 relies heavily on the concepts of Roles and Features. Well, SNMP is a Feature. So, in Server Manager I added the SNMP Feature.

Then, like in previous versions of Windows, I went to the Services UI, scrolled down to ‘SNMP Service’, right-clicked, and selected Properties.

I expected to see a nice series of tabs that would allow me to configure the SNMP Service with things like ‘community names’ and ‘trap destinations’. Instead, I only got the standard tabs you see on most Services. The service was installed and running, but there was no way to configure it.

Turns out, the ‘fix’ to this is simple… Log out and log back in. After logging back in, all teh SNMP configuration tabs were there.

You shouldn’t have to do that, but it is only a small inconvenience.

Friday, January 9, 2009

First Powershell Wrapper Functions for SourceGear Vault Client

I have written three functions so far. They cover the main tasks I perform when working with my Vault for my Powershell scripts.

They are:

  • In-VaultFile
  • Out-VaultFile
  • Get-VaultCheckoutList

A couple of items to note:

  • Getting the command-line to work was a bit tricky
  • The ‘vault.exe’ app outputs XML, which made generating feedback really nice. Of course, I didn’t know about [xml]$var at first. But, once I read about that, things moved along nicely.
  • I don’t like that I have to store my username and password in the cleartext in my script file. Not sure what options I have on that one. I certainly don’t want to have to type it out every time!
  • The Vault Command Line Client has a lot of other functions available. I will probably be adding wrappers for some others in the near future… Like creating new folders, viewing history, etc.

I love that we can expose only certain functions from within a module. That is cool!

Lastly, I just want to say THANK YOU to Mr. Snover and his team! I haven’t had this much fun working on computers in quite a while! Sys Admin is FUN AGAIN!

Anyway, here’s the code…

#################################################################
# FUNCTION: In-VaultFile
#
# WRITTEN BY: Derek Mangrum
#
# 2009-01-08 : Initial Version
#################################################################
function In-VaultFile
{
<#
.SYNOPSIS 
    Checks a file in to SourceGear Vault
.DESCRIPTION 
    Checks a file in to SourceGear Vault
.NOTES 
    Author     : Derek Mangrum  derek.mangrum@gmail.com 
    Requires   : PowerShell V2 CTP3 or later
.LINK 
    http://grinding-it-out.blogspot.com/
.EXAMPLE 
    In-VaultFile c:\scripts\file01.ps1 "This is my comment"
.EXAMPLE
    dir c:\scripts\Modules -Recurse -Filter *.psm1 | In-VaultFile -Comment "My comments"
.PARAMETER File
    The file that you want to check in.
.PARAMETER Comment
    Comments for the check in operation. Required.
#>
    
    param 
    ( 
        [Parameter(Position=0, Mandatory=$true, ValueFromPipeLine=$true)]
            [string]$File,
        [Parameter(Position=1, Mandatory=$true, ValueFromPipeLine=$false)]
            [string]$Comment
    )

    BEGIN
    {
    } #END BEGIN
    
    PROCESS
    {
        checkIn-File $File $Comment    
    } #END PROCESS
    
    END 
    {    
    } #END END
}

function checkIn-File
{
    param
    (
        [string]$File,
        [string]$Comment
    )
    
    if (Test-Path $File)
    {
        $item = (Resolve-Path $File) -replace 'C:', '$'
        $item = $item -replace '\\', '/'
        $user = userInfo
        $Comment = $Comment -replace " ", "_" 
        $command = "cmd.exe /C `"C:\Program Files\SourceGear\Vault Client\vault.exe`" CHECKIN -host $($user.Host) -user $($user.name) -password $($user.pass) -ssl -repository $($user.Repository) -comment $Comment $item"
        
        [xml]$result = Invoke-Expression $command
        
        if ($result.vault.result.success -eq "yes")
        {
            Write-Host "SUCCESS: " -ForegroundColor Green
            $result.vault.'#comment'
        }
        else
        {
            Write-Host "FAIL: " -ForegroundColor Red 
            $result.vault.'#comment'
        }
    }
    else
    {
        Write-Host "No such file: " -ForegroundColor Red -NoNewline
        $File
    }
}

#################################################################
# FUNCTION: Out-VaultFile
#
# WRITTEN BY: Derek Mangrum
#
# 2009-01-08 : Initial Version
#################################################################
function Out-VaultFile
{
<#
.SYNOPSIS 
    Checks a file out from SourceGear Vault
.DESCRIPTION 
    Checks a file out from SourceGear Vault
.NOTES 
    Author     : Derek Mangrum  derek.mangrum@gmail.com 
    Requires   : PowerShell V2 CTP3 or later
.LINK 
    http://grinding-it-out.blogspot.com/
.EXAMPLE 
    Out-VaultFile c:\scripts\file01.ps1
.EXAMPLE
    dir c:\scripts\Modules -Recurse -Filter *.psm1 | Out-VaultFile
.PARAMETER File
    The file that you want to check in.
#>
    
    param 
    ( 
        [Parameter(Position=0, Mandatory=$true, ValueFromPipeLine=$true)]
            [string]$File
    )

    BEGIN
    {
    } #END BEGIN
    
    PROCESS
    {
        checkOut-File $File
    } #END PROCESS
    
    END 
    {    
    } #END END
}

function checkOut-File
{
    param
    (
        [string]$File
    )
    
    if (Test-Path $File)
    {
        $item = (Resolve-Path $File) -replace 'C:', '$'
        $item = $item -replace '\\', '/'
        $user = userInfo
        $command = "cmd.exe /C `"C:\Program Files\SourceGear\Vault Client\vault.exe`" CHECKOUT -host $($user.Host) -user $($user.name) -password $($user.pass) -ssl -repository $($user.Repository) $item"

        [xml]$result = Invoke-Expression $command
        
        if ($result.vault.result.success -eq "yes")
        {
            Write-Host "SUCCESS: " -ForegroundColor Green
            $result.vault.'#comment'
        }
        else
        {
            Write-Host "FAIL: " -ForegroundColor Red
            $result.vault.'#comment'
        }
    }
    else
    {
        Write-Host "No such file: " -ForegroundColor Red -NoNewline
        $File
    }
}

#################################################################
# FUNCTION: Get-VaultCheckoutList
#
# WRITTEN BY: Derek Mangrum
#
# 2009-01-08 : Initial Version
#################################################################
function Get-VaultCheckoutList
{
<#
.SYNOPSIS 
    Lists all items currently checked out.
.DESCRIPTION 
    Lists all items currently checked out.
.NOTES 
    Author     : Derek Mangrum  derek.mangrum@gmail.com 
    Requires   : PowerShell V2 CTP3 or later
.LINK 
    http://grinding-it-out.blogspot.com/
.EXAMPLE 
    Get-VaultCheckoutList
#>
    
    BEGIN
    {
    } #END BEGIN
    
    PROCESS
    {
        getList
    } #END PROCESS
    
    END 
    {    
    } #END END
}

function getList
{
    
    $user = userInfo
    $command = "cmd.exe /C `"C:\Program Files\SourceGear\Vault Client\vault.exe`" LISTCHECKOUTS -host $($user.Host) -user $($user.Name) -password $($user.pass) -ssl -repository $($user.Repository)"

    [xml]$result = Invoke-Expression $command
    
    Write-Host "The following items are currently checked out"
    Write-Host "---------------------------------------------"
    
    if ($result.vault.result.success -eq 'yes')
    {
        foreach ($item in $result.vault.checkoutlist.checkoutitem) 
        {
            $item.checkoutuser.localpath
        }
    }
    else
    {
        Write-Host "ERROR" -ForegroundColor Red
    }
}

function userInfo
{
    $user = @{}
    $user.Name = 'MyName'
    $user.Pass = 'MyPassword'
    $user.Host = 'MyHost'
    $user.Repository = 'MyRepository'
    
    return $user
}

Export-ModuleMember In-VaultFile
Export-ModuleMember Out-VaultFile
Export-ModuleMember Get-VaultCheckoutList

Monday, January 5, 2009

First work with Virtual Machine Manager and PowerShell

To date, I have done ALL of my VMM management in the GUI. I have not used PowerShell at all (please don’t yell at me). Well, that changed today.

I got asked by my boss if two VMs were on the same host or not. I didn’t remember off the top of my head, so I opened the VMM Admin Console to check. So much clicking… and waiting…

I decided to see if I could get at this information via PowerShell. I mean, I figured I could, as I knew that VMM was PoSH-friendly. I also decided that I would use this opportunity to explore V2 CTP3 a bit and write one of those fancy, advanced functions. And, rather than dot-sourcing a .ps1 file (from within my profile) to get the function into my environment, I made it a module.

I just installed V2 CTP3, so I am brand new to these cool new features. But, it doesn’t seem too complicated.

Anyway, here is the function that checks a VMM servers for managed VMHost boxes and lists the VMs on each host. First, though, this information can easily be had with the following command:

Get-VM VMMServer COMP01 | select VMHost, Name

But, I wanted to play, so I wrote:

####################################
# FUNCTION: Get-VMEnvironment
#
# WRITTEN BY: Derek Mangrum
#
# 2009-01-05 : Initial Version
####################################
function Get-VMEnvironment
{
<#
.SYNOPSIS 
    Reports on VMM-managed environment
.DESCRIPTION 
    Lists VMs by VMHost
.NOTES 
    Author     : Derek Mangrum
    Requires   : PowerShell V2 CTP3 or later
    Requires   : Ping-Computer function
.LINK 
    http://grinding-it-out.blogspot.com/
.EXAMPLE 
    PS> Get-VMEnvironment
.EXAMPLE
    PS> "server1","server2" | Get-VMEnvironment
.PARAMETER VMMServer
    Name of VMM Server - DEFAULT: COMP01
#>
    
    param 
    ( 
        [Parameter(Position=0, Mandatory=$false, ValueFromPipeLine=$true)]
            [string]$VMMServer = "COMP01"
    )
    
    BEGIN
    {
        Write-Host
    }
    
    PROCESS
    {
        if (Ping-Computer $VMMServer) 
        {
            if (Get-WmiObject win32_service -computerName $VMMServer | Where-Object {$_.name -match "VMMService"}) 
            {
                Get-VMMServer $VMMServer | Out-Null
            
                Get-VMHost | ForEach-Object {
                    Write-Host "Report for VM Host: $($_.Name.Split(".")[0].ToUpper())";
                    Get-VM -VMHost $_ | 
                    Select-Object Name, StatusString | 
                    Format-Table
                } #END Get-VMHost...
            } #END if (gwmi...)
            else
            {
                Write-Host "$VMMServer is not a VMM Server.`n" -foregroundcolor Red
            } #END else
        } #END if (Ping-Computer $VMMServer)
        else
        {
            Write-Host "$VMMServer is not available.`n" -foregroundcolor Red
        } #END else
    }
}

Export-ModuleMember Get-VMEnvironment

Overkill? Probably… But fun!

Additional Info

My photo
email: support (AT) mangrumtech (DOT) com
mobile: 480-270-4332