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

Saturday, May 17, 2008

VLAN Implementation Issues

As I have described here, we are upgrading our network infrastructure and implementing VLANs, QoS, and Cisco Wireless. Fun stuff! But, we ran into a small snag today... Something I should have thought of but didn't.


This graphic shows the problem we encountered today... something we didn't think to test.

Our server room is connected to switch A, which is a managed switch and VLAN aware. Switches B and C were originally unmanaged switches and not VLAN capable. Our intention is to hang a WAP off of switch C, so we replaced it with another managed switch to get VLAN functionality there. This happened at the end of last week. Here is where we hit a hang up.

After replacing switch C with one that supports VLANs we tested connectivity on computer 2... everything worked fine! We thought we were good to go. But, we didn't bother testing computer 1, hanging off of switch B (an unmanaged switch). Of course, this test came this weekend, when we tried running Checkin for our Saturday evening service.

All of the computers hanging off of switch B had no network connectivity. But, computers on switch C were fine. It turns out that our problem was caused by our solution. When we put the new managed switch in location C, we turned trunking on for switch A (uplink to switch B) and for switch C (uplink to switch B). So, switches A and C were happily speaking VLANs, using switch B as little more than a repeater. But, the clients on switch B were not able to communicate on the network because switch B had no idea what VLAN to communicate on.

My solution was to turn trunking off for the uplink ports on switches A and C and just set all switches as access ports on our client VLAN. Then, everyone could work fine. But, what does this mean for our wireless implementation?

It looks like we are going to have to make sure that all of the switches in the path used by our WAPs will have to be managed IF they will also host client connections themselves. So, we will need to upgrade switch B as well. Then, we can re-trunk all of our uplink ports and re-implement VLANs.

Thursday, May 15, 2008

2008-05-15 PowerShell Exercise

UPDATE! Again, MoW shows me that I tend to make things a bit too complicated. Here he is turning my two-line script into a cool one-liner. I spent a few minutes trying to create a one-liner, but didn't get to it. But then, that's why I love reading MoW's blog! Whenever you can, learn from the master!

MoW's One Liner: del *.* -Exclude (dir | sort creationtime -desc)[0] -whatif

Today's Scripting Guys column shows the questioner how to delete all the files from a folder, except for the most-recently created file. Once again, this is the type of file-management solution that PowerShell is great for. In fact, I am guessing my solution is even more complex than it needs to be. But, this just speaks to my novice-ness. Still, PoSH beats VBScript once again!


Hey, Scripting Guy! I have a folder that has about 50 files in it. How can I delete all those files except the one most-recently created?
-- GA

Hey, Scripting Guy! Solution

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='C:\Logs'} Where " _
        & "ResultClass = CIM_DataFile")

dtmCurrentDate = #1/1/1980 8:00 AM#

For Each objFile In colFiles
    dtmFileDate = WMIDateStringToDate(objFile.CreationDate)
    If dtmFileDate > dtmCurrentDate Then   
        If strLatestFile <> "" Then
            strLatestFile = Replace(strLatestFile, "\", "\\")
            Set colOldFiles = objWMIService. _
                ExecQuery("Select * From CIM_DataFile Where Name = '" & strLatestFile & "'")

            For Each objOldFile in colOldFiles
        End If

        strLatestFile = objFile.Name
        dtmCurrentDate = dtmFileDate
    End If

Function WMIDateStringToDate(dtmCreationDate)
    WMIDateStringToDate = CDate(Mid(dtmCreationDate, 5, 2) & "/" & _
        Mid(dtmCreationDate, 7, 2) & "/" & Left(dtmCreationDate, 4) _
            & " " & Mid (dtmCreationDate, 9, 2) & ":" & _
                Mid(dtmCreationDate, 11, 2) & ":" & Mid(dtmCreationDate, _
                    13, 2))
End Function

My PowerShell Solution

$files = Get-ChildItem | Sort-Object CreationTime -Descending
for ($x=1;$x -le $files.Count - 1; $x++) {Remove-Item $files[$x] -WhatIf}

NOTE: Remove the -WhatIf if you want to actually delete the files. This is another great PoSH feature. Most cmdlets have the -WhatIf tag. So, you can run the commend and see what it would do, without actually doing it. This is great to destructive cmdlets... such as Remove-Item.

Thursday, May 8, 2008

Why I Love Virtualization - Reason# 482

We are going to be doing a demo of a media streaming solution next week. For the demo, we need to be able to throttle the pipe between the two streaming boxes.

image This diagram shows the desired setup. Basically, we want to connect a camera to the 'send' video streaming unit and a projector to the 'receive' video streaming unit. In the middle will sit a bridge that will have the throttling functionality.

After some research, we landed on SoftPerfect Bandwidth Manager. It does exactly what we need and has a 30-day trial period. The software is super-cheap and if we had a long-term need for this type of tool, it would be a real steal!

But, I am supposed to be saying why I love virtualization so much. So, today's reason is: HUGE TIME SAVER!

When this project first came up (which was just this afternoon), we brainstormed how to go about it. Initially, I was just going to use an older server we had laying around and were not using. So, I grabbed the server, a big rack-mount beast weighing way-too-much! I set it up on my work table and went to fetch a keyboard, mouse, and monitor. As I was booting up the server (which is as loud as it is heavy!), I realized that I was also going to need two 'client' machines to send traffic between. The mental image of three computers, three monitors, three keyboards, and three mice stacked on my little work table was not pretty. Then I thought to myself, "Why aren't I doing this with VMs?"

So, I shut down the server (Ahhhhh.... sweet silence!) and RDP'd in to my Hyper-V box. This server was only hosting one machine, so there was plenty of room for my test environment. The following steps got things going in no time:

  • Snapshot the current VM
  • Sysprep and shut down the current VM
  • Make three copies of the VHD file
  • Restore the original VM to the pre-Sysprep snapshot and bring it back up
  • Create three VMs, attaching each one to its own VHD copy
  • Bring up the three VMs and configure as needed (network settings, install Bandwidth Manager, etc.)

So, in about 30 minutes, I had my lab environment up and running, ready to test various configuration scenarios. Again, snapshots came in handy as I could have a baseline system and then make various changes. If something didn't work, I didn't have to worry about uninstalling, reconfiguring, or anything else. Just restore the pre-config snap!

We were able to test various options and finally landed on a solution that is going to work for us and our demo.

This job is just too much fun!

Wednesday, May 7, 2008

Error Number: 0x80072EE2

I was getting this error today when attempting Windows Updates on one of my servers. The environment made this a bit unique. This particular server is a Windows 2003ENT 32Bit VM being hosted on a Hyper-V VM Host Server.

I created the VM and installed the OS. The first thing I did after that was attempt Windows Updates. After a few minutes, I got the error listed above.

It turns out there were two issues causing problems. The first one, which doesn't seem to be specific to my VM environment, was that the BITS service was not running. It was set to manual and was stopped. I set it to automatic and started it.

The second item seems to be an issue with the Hyper-V environment. I found the solution here. Here is a quote of the contents of the posted solution:

I found the solution-- more searching after this post indicated a registry
setting was tweaked but the information given was incorrect. Turns out you
need to put this in the guest VM's registry:
Value(DWORD): DisableTaskOffload = 1

(the incorrect mention was called DisableTaskOffset which I am putting here
in hopes anyone who searches for that will find this as well)

(information obtained from!3110BDF94643CB31!354.entry helped in


As noted in this post, I added the registry key, rebooted, and things are working fine. I hope that this is resolved in the RTM version of Hyper-V. I would hate to have to do this step to every new VM I create. Ok, maybe hate is a strong word, but it would be a bit annoying.

Friday, May 2, 2008

2008-05-02 PowerShell Exercise

Well, it's been a while since I have posted a PowerShell example. But, today's "Hey, Scripting Guy" is another great example of how PowerShell can really be the right tool for the right job. Now, to be fair, the question specifically asked about using VBScript. But, why not use PoSH when the solution is so much more elegant? Just look...


Hey, Scripting Guy! I Using VBScript, how can I identify the 20 most-recently modified files in a folder?
-- TW


Const adVarChar = 200
Const MaxCharacters = 255
Const adFldIsNullable = 32

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='C:\Scripts'} Where " _
        & "ResultClass = CIM_DataFile")

Set DataList = CreateObject("ADOR.Recordset")
DataList.Fields.Append "FileName", adVarChar, MaxCharacters, adFldIsNullable
DataList.Fields.Append "ModifiedDate", adVarChar, MaxCharacters, adFldIsNullable

For Each objFile In colFiles
    DataList("FileName") = objFile.Name
    DataList("ModifiedDate") = objFile.LastModified

DataList.Sort = "ModifiedDate DESC"

For i = 1 to 20
    dtmWMIDate = DataList.Fields.Item("ModifiedDate")
    dtmConvertedDate = CDate(Mid(dtmWMIDate, 5, 2) & "/" & Mid(dtmWMIDate, 7, 2) & _
        "/" & Left(dtmWMIDate, 4) & " " & Mid (dtmWMIDate, 9, 2) & ":" & _
            Mid(dtmWMIDate, 11, 2) & ":" & Mid(dtmWMIDate, 13, 2))
    Wscript.Echo DataList.Fields.Item("FileName") & " -- " & dtmConvertedDate


Get-ChildItem | Sort-Object LastWriteTime -Descending | Select-Object -First 20

Additional Info

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