Wednesday, October 31, 2012

Installing Cisco Fabric Manager on Windows 7 x64

Installing Cisco Fabric Manager on Windows 7 x64


1. Download the latest version from the Cisco site.

Cisco MDS 9000 Family Management Software and Documentation CD-ROM - Image for vX
http://www.cisco.com/cisco/software/type.html?mdfid=282731430&catid=null

2. Download Java RE 1.6 - At the time of writing this the FM (4.2.9) software does not support Java RE 7.

http://www.filehippo.com/download_jre_32/13491/

3.  Right click on Command Prompt > "Run as administrator"

 >  cd "c:\Program Files (x86)\java\jre6\bin"

(example command line)
 >  java.exe -Xmx512m -jar "C:\m9000-cd-4.2.9\software\m9000-fm-4.2.9.jar"

From there it's next - next - next.

-Shep

Thursday, July 5, 2012

Exchange: Mailbox and Database Storage Statistics PowerShell Export

Bear in mind this is version 1 so there aren't any variables to pass into yet. I'd like to get this a little more modular so you would adjust the command line instead of digging through the script for things like the mail server and such. Still, it does what I need it to. I'll highlight what you would need to update for your environment.

One tip for something I've done in the past. If you have SharePoint you can mail enable a library and email these to it. Then you capture the change in space over time so you know how your storage is changing. Plus it gets this valuable data out of your inbox.

This is particularly helpful when trying to right size your DBs and manage your various drives (typically it's best to put each DB on it's own drive letter).


#Gets mailbox statistics from specified mailbox server. Returns User, Size, Item Count, and which database the mailbox is in.


$MailboxStatsFileName="MailboxStats-" + $(get-date).tostring("MMddyyyy") + ".csv"
$MailboxStatsDeleteFileName="MailboxStats-" + $(get-date).adddays(-35).tostring("MMddyyyy") + ".csv"

Write-Output "Creating mailbox stats: $($MailboxStatsFileName)"
Get-MailboxStatistics -server ServerName | Select-Object DisplayName,@{label=”User”;expression={$_.LastLoggedOnUserAccount}},@{label=”Total Size(MB)”;expression={$_.TotalItemSize.Value.ToMB()}},ItemCount,Database | Export-CSV "C:\Reports\$($MailboxStatsFileName)"

#Pause to allow time for export
Start-Sleep 20

function Get-DatabaseStatistics {
    $Databases = Get-MailboxDatabase -Status
    foreach($Database in $Databases) {
        $DBSize = $Database.DatabaseSize
        $MBCount = @(Get-MailboxStatistics -Database $Database.Name).Count
$MBAvg = Get-MailboxStatistics -Database $Database.Name |
          %{$_.TotalItemSize.value.ToMb()} |
            Measure-Object -Average           
New-Object PSObject -Property @{
            Server = $Database.Server.Name
            DatabaseName = $Database.Name
            LastFullBackup = $Database.LastFullBackup
            MailboxCount = $MBCount
            "DatabaseSize (GB)" = $DBSize.ToGB()
            "AverageMailboxSize (MB)" = $MBAvg.Average
            "WhiteSpace (MB)" = $Database.AvailableNewMailboxSpace.ToMb()
        }
    }
}


#Runs function to gather server/database stats including whitespace
$DBFileName="DBStats-" + $(get-date).tostring("MMddyyyy") + ".csv"
$DBDeleteFileName="DBStats-" + $(get-date).adddays(-35).tostring("MMddyyyy") + ".csv"

Write-Output "Creating DB stats: $($DBFileName)"
Get-DatabaseStatistics | Export-Csv "C:\Reports\$($DBFileName)" -Force -NoType

#Pause to allow time for export
Start-Sleep 15

Write-Output "Emailing: $($MailboxStatsFileName) and $($DBFileName) to sys admins"
#Send email to admins with report info for mailboxes and databases.
Send-MailMessage -To email@company.com -From Exchange@Company.com -Subject "Email Statistics for $((get-date).ToShortDateString())" -SmtpServer mail.company.com -Attachments "C:\Reports\$($MailboxStatsFileName)", "C:\Reports\$($DBFileName)"


if (test-path -Path "C:\Reports\$($MailboxStatsDeleteFileName)")
{
  Write-Output "Deleting Old Mailbox Stats"
  Remove-Item -Path "C:\Reports\$($MailboxStatsDeleteFileName)" -ErrorAction SilentlyContinue
}

if (test-path -Path "C:\Reports\$($DBDeleteFileName)")
{
  Write-Output "Deleting Old DB Stats"
  Remove-Item -Path "C:\Reports\$($DBDeleteFileName)" -ErrorAction SilentlyContinue
}

Exchange: Mailbox Database Whitespace


Get-MailboxDatabase -status | select-object name,availablenewmailboxspace

I may have to look at combining this with another post for exporting mailbox and DB storage stats. Either as another value on that dump or another csv to email out.

Exchange: Bulk Mailbox Database Migrations


AUTO SUSPEND

$targetDB="DATABASENAME"

$users = Import-Csv C:\Mailbox\Move.csv
foreach ($user in $users)
{
Write-Output "Processing User: $($user.UserName) at $(get-date)"
Get-Mailbox -Identity $user.UserName| New-MoveRequest -BatchName 'MyBatchName' -SuspendWhenReadyToComplete -TargetDatab5ase "$($targetDB)" -BadItemLimit 5
Write-Output "Finished Processing User: $($user.UserName) at $(get-date)"
}


NO SUSPEND
$targetDB="DATABASENAME"


$users = Import-Csv C:\Mailbox\Move.csv
foreach ($user in $users)
{
Write-Output "Processing User: $($user.UserName) at $(get-date)"
Get-Mailbox -Identity $user.UserName | New-MoveRequest -BatchName 'MyBatchName' -TargetDatabase "$($targetDB)" -BadItemLimit 5
Write-Output "Finished Processing User: $($user.UserName) at $(get-date)"
}


Some other helpful one liners to go with the previous scripts.

Get-MoveRequest -MoveStatus 'InProgress' -BatchName 'MyBatchName'
Get-MoveRequest -MoveStatus 'AutoSuspended' -BatchName 'MyBatchName'
Get-MoveRequest -MoveStatus 'CompletionInProgress' -BatchName 'MyBatchName'


Get-MoveRequest -MoveStatus 'AutoSuspended' -BatchName 'MyBatchName' | Resume-MoveRequest

Exchange: Message from an Address for Time Period

Just a quick one liner

Get-MessageTrackingLog -ResultSize unlimited –Sender “address@company.com” -Start "6/21/2012 12:00AM" -End "6/22/2012 7:50AM" | Export-CSV C:\commadelimitedoutput.csv

Wednesday, April 18, 2012

MMS 2012 - where to begin!

Learning a ton of new stuff in Las Vegas this year. Hopefully we can get back to WI and really kick things into high gear. There's so much to do. It's funny how you come out with a certain mindset about what you want to learn about based on what you knew yesterday. Some of that is getting turned on its head.

I was looking forward to really hitting CM and OM 2012. We get out here and whoa. We really need to look at ramping up our VDI and dig into Intune. I wrote a completely separate post because I'm so pumped about the VDI potential.

Service Manager would also be a huge asset which we already knew. We just didn't know what a heavy investment we would have to make in our infrastructure to do it. 4 server minimum?? Orchestrator plays a huge role here too in building workflows. If you can squeeze in the time to build it out there are tons of time savings to be had. User add/change/remove was a great example here. Someone starts with the company what do you do? Create the AD account, Exchange account, Lync, folder perms, deploy a workstation, and so on. All possibly automated with business intelligence (approvals and such) built right in. Awesome.

SUP with CM2012 is improved. I don't hate our process now and it's just going to get better!

OM network monitoring is greatly improved really opening communication with network engineers.

Let's not forget Server 2012 was announced. While they were talking about new storage features and hyperv it struck me, "does that mean AD 2012". Man it's going to be a busy year!

We're over halfway through but I'm sure there's more great stuff on the way. It's a little overwhelming but I'm really excited at the potential of it all. Hopefully we can overcome blockers and really deliver great solutions for our users. It's all "user centric" now after all!

-Shep

Thursday, April 5, 2012

HP StorageWorks MP for SCOM

Hopefully I'll have more successful info in the future...<coming soon>

I'm currently working on getting the HP StorageWorks Management Pack for SCOM going. The guide that comes with the download isn't bad. However, I still can't seem to get our P4000 series servers to populate. I've talked to HP several times and they're not even sure where to direct the question. I talked to a pretty knowledgeable guy on the P4000 team but he hasn't been able to find anyone just yet. I did successfully generate test traps from the P4000 CMC to SCOM. However, I really wanted to see the diagram view :(  I also added my P4000 nodes and clusters as network devices without any issues.

The other thing I'm trying to get working with it is our HP MSL4048 tape library. I added the network device which works fine. However, the actual alerts...no dice. I even went as far as building a new 2008R2 server with CommandView for Tape Libraries (since the management pack has a CommandView node). Still no love.

http://h18006.www1.hp.com/storage/SCOM_managementpack.html

fyi, local drives on our HP DL380s showed up right away so that was pretty cool. No special config was required.

I'm hoping getting a post out here will drum up some interest. Anyone having any luck? Same problems?

Update 4/10/2012
Working with HP support today. Trying to get to the SCOM MP team (teir 3). Sent over some bundle info from P4000 CMC. Also ran this utility to send them a ton of logs. Hopefully I'll have some answers soon.

http://update.external.hp.com/HPS/HPSreports/

Update 4/21/2012
I was at MMS this week and met the product manager for the HP StorageWorks management pack team. I explained the above about the P4000 diagram view. The tech with him laughs and says "yea I can't get it to work either". Sooo...I got the manager's business card. We'll see what turns up.


-Shep

Monday, April 2, 2012

Automatically Install SNMP with PowerShell and ConfigMgr

For various reasons I found that I need to deploy SNMP Services; the SNMP Service AND WMI provider to many servers in a more efficient manner. That mean installing to server 2003, 2008, and 2008R2 preferably with a single method. Whatever I came up with need to work even if some or none of the components were installed. I also wanted to configure the settings (covered in a different post). The following is what I came up with after quite a bit of effort. Hopefully this will save someone undo hardship!

I found this bit of PowerShell that will install SNMP in about 10 seconds or less.
Source: http://poshcode.org/2066

The basics

If you're just testing to make sure it works this is the core of the script....

   Import-Module ServerManager
   Add-WindowsFeature SNMP-Services


The Script's Shortcomings



So after tinkering with this code for the better part of 4-5 days straight. I came to a few conclusions.

  1. The script doesn't factor in server 2003 vs. 2008 OR PowerShell v1 vs. v2. The "ServerManager" module is only available in PowerShell v2 and only works on Server 2008R2. Therefore, I added a check to see if the ServerManager module was even available. This covers both of the aforementioned prerequisites.
  2. There is no check for whether or not some of the SNMP functionality is installed. i.e. the service but not the WMI provider (such was the case in my environment). It blindly checks for just SNMP Services as a whole. I added checks for SNMP Services, Service, and WMI Provider individually.
  3. There can be multiple blockers to implementing full automation.
    1. PowerShell Execution Policies for remote signing.
    2. Missing DLLs

Taking it to the Next Level

The rest of this post will be a comprehensive guide to fully automating this process. This includes the necessary group policies, shared DLL repositories, Configuration Manager packages, and more.

Why Not MDT?
Now if you're thinking, "why not just use MDT?!?" I'll tell you why...MDT doesn't support SNMP feature install to pre-2008R2 either since it ties into the ServerManager module as well (as I understand it). Though it does a handful of others including DNS and DHCP. Anyway, my logic was to have all server components managed with a single method vs. PowerShell sometimes and MDT others. That being said I hope to follow this up with an MDT how to for the same thing.

The Steps


  1. Extract i386 directory from Windows Server 2003 ISO/DVD to a share (preferably on site server if using ConfigMgr)
  2. Create Group Policies 
    • Set DLL Paths: Group Policy Preferences to modify the registry of targeted Windows Servers. Populate the install path for i386 files (default would typically be CD/ISO drive from initial install)
    • Configure PowerShell Execution Policy (or sign your scripts, both in posts to follow)
  3. Create an answer file for sysocmgr since that's the only way to automate pre-2008R2
  4. Create package containing the .PS1 script and .TXT answer file
When you see it as 4 steps it seems a little less intimidating. At least it seems that way to me :)


i386 DLLs

One of the first things I ran into with a working script was Server 2003 looking for the necessary DLLs


snmpcl.dll
snmpincl.dll
snmpsmir.dll
snmpthrd.dll
smi2smir.exe
snmpreg.mof
snmpsmir.mof
snmpstup.dll
smierrsm.dll
smierrsy.dll
smimsgif.dll

I decided to tackle this by placing the entire directory on a network share and update the default sourcepatc variables to that share. I figured this way future component installations beyond SNMP can reference the same path.

GPO

Neither of the following group policies are necessarily required for ALL environments. I'll explain...

DLL path via Group Policy Preference: Only required for pre-2008R2 deployments. If you're dealing with only 2008R2 servers you can probably skip this one for now since the ServerManager cmdlet will kick in.


HKLM\software\microsoft\windows\CurrentVersion\Setup

REG_SZ: SourcePath 
VALUE: <i386 share>

HKLM\software\microsoft\windows\CurrentVersion\Setup 
REG_SZ: ServicePackSourcePath
VALUE: <i386 share>


Configure PowerShell Execution Policy = Unrestricted: I believe this is the default for Windows Server so unless you've explicitly enabled remote signing via some other GPO or other method you may be able to skip this as well.


You can check this on any server by typing the following command at a shell prompt

   Get-ExecutionPolicy

SYSOCMGR and Answer File

There are lots of great resources for using SYSOCMGR so I won't belabor the point. Here's the command and the associated answer file. Just drop the answer in a text file. The rest is in my script. This execution correctly will ride on the correct placement of the source files and registry settings.

sysocmgr /i:%WINDIR%\inf\sysoc.inf /u:<SNMP ANSWER FILE>.txt /r /x /q

Answer File

;SetupMgrTag
[NetOptionalComponents]
SNMP=1
wbemsnmp=1
[SNMP]
Any_Host=YES

The Script


This is where all of the magic happens.




#Powershell Script To Install SNMP Services (SNMP Service, SNMP Service, SNMP WMI Provider)


#--------------------NON-SERVER 2008R2-----------------------

if ((get-module -ListAvailable ServerManager) -eq $Null)

{
write-output "Installing SNMP Components for non-Server2008R2 System"

sysocmgr /i:%WINDIR%\inf\sysoc.inf /u:<SNMP ANSWER FILE>.txt /r /x /q

exit
}


#--------------------SERVER 2008R2---------------------------


#Import ServerManger Module (adds Add-WindowsFeature cmdlet)
Import-Module ServerManager

#Check If SNMP Services Are Already Installed
$checkSNMPServices = Get-WindowsFeature | Where-Object {$_.Name -eq "SNMP-Services"}

If ($checkSNMPServices.Installed -eq "True")
{
    write-output "SNMP Services were found on this system. Checking if sub-components are installed."
   
    #Check If SNMP Service is Installed (note: "SNMP Service" not "Services")
    $checkSNMPService = Get-WindowsFeature | Where-Object {$_.Name -eq "SNMP-Service"}
    If ($checkSNMPService.Installed -ne "True"){
        #Install/Enable SNMP Service
        Write-output "SNMP Service is not currently installed: Installing"
        Add-WindowsFeature SNMP-Services | Out-Null
    }
   
    Else {Write-Output "SNMP Service Not Required"}
   
    #Check If SNMP-WMI-Provider is Installed
    $checkWMIProvider = Get-WindowsFeature | Where-Object {$_.Name -eq "SNMP-WMI-Provider"}
    If ($checkWMIProvider.Installed -ne "True"){
        #Install/Enable SNMP Service
        Write-output "SNMP WMI Provider is not currently installed: Installing"
        Add-WindowsFeature SNMP-Services | Out-Null
    }
    Else {Write-Output "SNMP WMI Provider Not Required"}
}

else
{
    write-output "No SNMP Services were found installed on this system. Installing SNMP and sub-components"
   
    #Install/Enable SNMP Services
    Add-WindowsFeature SNMP-Services | Out-Null
}





Automating the Push with ConfigMgr

So far I haven't been able to get this to work. I suspected it was an issues with the execution policy or UAC (hence the GPO for execution policy). Haven't been able to nail down the culprit yet. However, running the script is still faster. Here's what I was trying as my command line. I would love to hear from someone if they have success deploying the script through SCCM. I'll keep working on it.


Content 
InstallSNMP.PS1
SNMP-sysocmgr-answer.txt

Command
powershell.exe -WindowStyle hidden -file InstallSNMPComponents.ps1



Final Notes
I've read in a few spots that you do not want to use SYSOCMGR to install Windows components on a SQL Server because of how it stops services. Fortunately, I read this before trying it so I haven't done so myself. Just passing along the warning.


Feel free to drop me a note if you have questions about this process. I realize when thinking about the entirety it can be a bit overwhelming. Happy to help answer what I can.

-Shep

Thursday, March 29, 2012

SCOM Groups Dyanmic Members OU Recursive

Recently I went looking for a good way to add a group of servers to system center operations manager a bit more dynamically. I came across this article which I found very handy.

http://contoso.se/blog/?p=170


However, the last thing he says is..."Please note that this will only include machines in the OU specified, it you want to include computers from another OU you can simple add a “OR” expression."

Seems tedious at right? So I started looking for how to do recursive OU membership adds in SCOM. I found a bunch of stuff siting how to use custom LDAP queries, PowerShell, custom management packs. bleh...

Here's what I came up with....

  1. Note the highest level OU for which you want to capture all sub-systems
  2. Go to one of the systems in SCOM and view the properties in "Monitoring". One of the values will be "Organizational Unit" > Copy it
  3. Create your Dynamic Members inclusion rule
  4.  Select "Windows Computer" > Add
  • Property = "Organizational Unit"
  • Operator = "Matches Wildcard"
  • Value = *< OU that you copied in step 2>
e.g.

*OU=XenApp-65,OU=Servers,DC=MYDOMAIN,DC=com

Works like a charm!

-Shep

Wednesday, February 8, 2012

Video Documentation FTW

I highly recommend anyone doing any type of technical documentation look at Camtasia Studio from TechSmith (or something like it). Crazy easy to use. We tried free solutions like CamStudio to start which was a good proof of concept. However, Camtasia blew it out of the water. This solution was an absolute documentation gold mine for our IT department. We are able to knock out thourough tutorials in minutes not hours. We never miss a step, screen shot, or otherwise. Heck, I documented a Great Plains SQL backup, server Windows Updates, DNS Scavenging, temp profile corruption for 2008 R2, and Exchange mailbox migrations. That was just this afternoon, not even joking. When was the last time you documented 5 systems in a day, much less a month?

My favorite use case so far is the dreaded vendor support call. I can be on the line with Microsoft for an hour and a half and record the whole thing. I just did troubleshooting for DNS aging and scavenging. 100 minutes of footage trimmed down to 6 minutes of reusable documentation. I'll keep the rest of the video for future reference.

Another good example was the reverse. I wanted to show the vendor what I did. I was installing VMware ESXi 4.1 and ran into a snag with HP iLO mounting virtual media to install without having to drive to the data center (sounds simple right?). It worked on other servers just not this one. I recorded basically BIOS level troubleshooting for 3 hours. Later when I contacted VMware for support they said "what's the error?" "oh, let me fast forward to that". No rehashing what I had already done. "what's the bios version" "let's go back to the first 30 minutes". Long story short, turns out incompatible blah blah don't use an ISO so I went for a ride. One of the easiest support calls ever.

It's so simple it's genius. Yet we've been making Word docs with screenshots for years. Never again I say! We've almost converted our entire library of documentation into video screen casts (HD of course), being sure not to leave out relevant title pages for intro info and captions for the "why" behind the steps.

It's no exaggeration to say I have our entire department literally giddy about doing documentation. I keep hearing "How many videos did you to today?" It's a few hundred for an application but you'll NEVER regret it.

-Shep