June 10 2009

Nifty Powershell script to ping multiple servers

This great Powershell script will ping all machines listed in a text file and put the live results into a Excel workbook:

$erroractionpreference = "SilentlyContinue"
$a = New-Object -comobject Excel.Application
$a.visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "Machine Name"
$c.Cells.Item(1,2) = "Ping Status"
$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True
$intRow = 2
$colComputers = get-content C:\temp\server_list.txt
foreach ($strComputer in $colComputers)
$c.Cells.Item($intRow, 1) = $strComputer.ToUpper()
# This is the key part
$ping = new-object System.Net.NetworkInformation.Ping
$Reply = $ping.send($strComputer)
if ($Reply.status -eq "Success")
$c.Cells.Item($intRow, 2) = "Resolved & active"
elseif ($Reply.status -eq "TimedOut")
$c.Cells.Item($intRow, 2) = "Resolved host but timed out"
$c.Cells.Item($intRow, 2) = "Unable to resolve"
$Reply = ""
$intRow = $intRow + 1


I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.


June 6 2009

SCOM R2 – Service Name Changes

Display names of the services changed in the R2 version of SCOM 2007.  The names themselves did NOT change, so if you use ‘net stop’ or ‘net start’ that will not be affected. If you are looking for the services in the services.msc, the new names are list below. It had me stumped for a few minutes!

Here’s a breakdown:

Name (SP1/R2) DisplayName (RTM/SP1) DisplayName (R2)
OMCFG OpsMgr Config Service System Center Management Configuration
OMSDK OpsMgr SDK Service System Center Data Access
HealthService OpsMgr Health Service System Center Management
Category: Windows | LEAVE A COMMENT
June 2 2009

Change Product Key On Windows Server 2008

Open the command prompt and navigate to %windir%System32 directory

slmgr.vbs -cpky (this clears the KMS entry you may have)
slmgr.vbs -upk (this removes any product key installed)
slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx (where the x’s are the new product key you want to use)
slmgr.vbs -ato (this activates the server)

Type slmgr.vbs for further options….

Category: Windows | LEAVE A COMMENT