September 2008 Archives

VBScript to Determine a PC's Need for a Reboot

| No Comments | No TrackBacks

From time to time in Windows administration and patch management, it's necessary to know whether a machine you're about to do something to is waiting on a reboot. When an installer program needs to replace a file that's in use, it can't do that, so it places the file on the disk with a temporary name and places a value in the Windows Registry to indicate that the file needs to be renamed at the next reboot. Therefore, if you want to detect whether a given machine needs a reboot in order to complete the work of a previously-applied hotfix, patch, or software install, you can look at that value in the Registry to see if there's any work to be done on the next reboot. If there is, the machine needs a reboot. If there's nothing there, the machine doesn't need a reboot.

The Registry key you need to examine is a MultiString Value called, aptly enough "PendingFileRenameOperations" located on the following Registry path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager

Below is a sample VBScript to perform a test of the local or a remote machine to see if a reboot is needed based on the PendingFileRenameOperations key. The script must be run with Administrator permission on the system to be checked. If run without Administrator permission, the script will be unable to connect with the remote machine and an error will be displayed.

When executed, the script prompts for the name of a PC on the network, which can be the PC you're using at the time. If no PC name is entered, the script aborts. Otherwise, it makes a Windows Management Instrumentation (WMI) call to the Registry provider on the remote machine and requests the value of the PendingFileRenameOperations key. If an actual value is found, this means that PC requires a reboot. If no value is found or the key isn't there, then the PC does not require a reboot. A message is displayed for the user indicating if the machine in question does or does not need to be rebooted.

I hope you'll find the script useful.

dim oReg

'
' Set a constant we'll use later
'
Const HKEY_LOCAL_MACHINE = &H80000002

'
' Ask the user for a PC name to check and abort if they
' don't give us one.
'
strComputer = InputBox("Which PC do you want to check?",_
                 "Reboot Need Checker")

if strComputer="" then
  wscript.quit
end if

thePC = ltrim(rtrim(strComputer))

'
' Use the Windows Management Instrumentation (WMI) capability
' to connect to the remote computer's Registry provider.
'
on error resume next
set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
           strComputer & "\root\default:StdRegProv")

If Err.Number <> 0 Then
   MsgBox "Could not connect with WMI to PC " & strComputer & _
          "'s Registry.", vbOKOnly, "ERROR!"
   wscript.quit
End If

'
' Use the WMI Registry Provider to look up the reboot status in
' the remote PC's Registry. Display an error if we can't do it.
'
strvalue = "NOTHING"
strKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager"
strValueName = "PendingFileRenameOperations"

oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,_
                         strKeyPath,_
						 strValueName,_
						 arrValues

If Err.Number <> 0 Then
     MsgBox "Could not read reboot status for the PC " & _
	        strComputer, vbOKOnly, "ERROR!"
     wscript.quit
End If
    
'
' If arrValues returns a non-zero value below, then there are filenames in
' the PendingFileRenameOperations key, and therefore a reboot
' is needed to complete those rename operations.
'
if arrvalues > 0 then

   msgbox strComputer & " requires a reboot at this time. ", _
          vbokonly,"Reboot Needed"

else

   msgbox strComputer & " does not require a reboot. ", _
          vbokonly,"No Reboot Needed"
   wscript.quit

end if

My "Go To" Websites

| No Comments | No TrackBacks

The web is full of a lot of interesting, funny, and informative stuff. I was walking back from the cafeteria today with some of my co-workers when the topic of web sites came up. I shared with them the web sites I like to visit every day if I can find the time. I thought you might find the list useful, so here goes...

  • Woot.com: This site offers a different product every day, which can be almost anything, at a deep discount. The product offered can be a hard drive, a golf club, a hammock, a laptop computer, a big-screen TV, or any of hundreds of other items. If you like the item they're offering and the price, you buy it. If not, move on. Some of the best parts of this site are the product descriptions, which are some of the funniest stuff on the web. I also enjoy their podcast, which usually contains music reminiscent of They Might Be Giants or Devo. Occasionally, Woot does what they call a "woot off" where a long string of items is posted one at a time on the site until each one sells out. They just finished one of these yesterday.
  • Sellout.woot.com: This sister site to Woot.com also offers an item each day at a discount. This is a different item from the one on the main Woot site, but is sometimes complementary (e.g., an iPod on one and an iPod docking device on the other).
  • Shirt.woot.com: This sister site to Woot.com offers a different T-shirt each day. The prices are more reasonable than most other t-shirt sites on the web, and the shirts offered range from the artistic to the geeky.
  • User Friendly - The Comic Strip: If you're a technology/IT person like I am, you'll appreciate the antics of the characters on this web site, who work as consultants, tech support, and corporate IT. The strips tend to poke fun at science, technology, and related issues.
  • Dilbert - The Comic Strip: If you have a corporate job, it's pretty easy to identify with this classic syndicated comic strip.
  • Giveaway of the Day: This site offers, for free, a Windows software product that you'd otherwise have to pay for. Each day it's a new product. The product might be a utility like a disk defragmenter, a project management tool, a video editor, a PDF to HTML converter, or something else. If the product is useful to you, it's free if you download and install it immediately. (I also find it useful practice to repackage these downloads using Wise Package Studio.)
  • Game Giveaway of the Day: This sister site to giveawayoftheday.com offers, typically less often than once a day, a game you'd otherwise have to pay for. Again, you may not like some of the games they offer, but it's hard to argue with the price (free).
  • Yugster.com: Like Woot, Yugster offers 1-2 products a day and sells them until they're gone or it's time to bring on the next product.
  • Fark: This web site is kind of like a "headline news of the weird". It features stories from all over the web, and all over the world, focusing on the more offbeat, bizarre, and humorous. I like to read this one on my lunch hour.
  • iGoogle: Google offers a customized home page for users who set up an account with them. Using this customized home page, you can display the top technology headlines from any site with an RSS feed (like this one). You'll be able to tell instantly if something useful or interesting appears on your favorite sites without leaving your web browser's start page (assuming you set iGoogle up as your start page). I use it to keep track of Crave: The Gadget Blog, technology news sites, Slashdot, and CNet News.
Here are some of the other sites I like to visit regularly, but that I don't visit as often as the above:
  • Amazon.com: I like to check in to see what Amazon thinks I might be interested in. Often, they're right. I keep a "wish list" on Amazon.com so that friends and family members can get ideas for gifts I might like.
  • Newegg.com: This site specializes in computers and computer components at inexpensive prices. When I need a bit of technology, I usually look here for it first. If they have it, it's often going to be at one of the lowest prices on the web.
  • Pacific Geek: This site offers deep-discount computer technology items, including lots of cheap little electronic gadgets and toys. My office is decorated with a lot of crap from here.
  • Think Geek: This is kind of the "Sears Christmas Toy Catalog" for geeks. You can find a million little gadgets, gizmos, and things that us geeks find amusing. They offer products like a duct tape wallet, caffeinated soap (really!), bumper stickers that say geeky things like "Got root?", and animated doormats. I keep a wish list here, too.

Papillary Carcinoma and Me

| No Comments | No TrackBacks
(This blog entry contains medical information which is based on what I've read and what I've understood from my doctor's words.  It should not be construed as medical advice or in any way be used by anyone to make medical decisions  I am not a doctor.  I share this information both to help myself process what is happening to me and to give others who might receive the same diagnosis comfort from knowing they're not alone in the world.  Please consult a licensed medical professional rather than rely on anything you read in this blog.)

A few months back, I noticed that it seemed like the medications I took in the morning were getting stuck in my throat.  I'd go most of the morning feeling like I had a capsule in there that just wouldn't go down.  Then I noticed on mornings I forgot to take my medications that it still felt that way.  I thought I'd massage my throat and see if it helped with the sensation any.  In doing so, I found a rather large lump. It felt like about half the size of a golf ball.

While in a doctor's office about another issue, I asked him to examine the lump to see if it was anything I should worry about. He estimated its size and 2.4 centimeters in diameter.  He ordered an ultrasound examination to get some idea what it was.  The ultrasound showed that where he'd expected to find only fluid, there appeared to be some solid components.  He said this wasn't unusual, and that sometimes when a lump like that (which he told me was on my thyroid) grows quickly it can choke off healthy tissue, which then floats around inside it. To be safe, he ordered a "needle biopsy" or "fine needle aspiration" of the lump.

This morning, my wife and I got the results of the lab examination.  It was thyroid cancer, more specifically "papillary carcinoma".  He said it was unusual to find actual cancerous cells in the biopsy. More often, they're "unusual" cells that indicate the possible presence of cancer, but not actual cancerous cells.

Apparently, this particular type of thyroid cancer is very slow growing.  He says I've probably had this lump in my throat for years and didn't know it until it got large enough to interfere with my swallowing.  Generally speaking, the prognosis for people who contract this particular variety of cancer is good.  According to one web site I read, over 95% of the people diagnosed with papillary carcinoma are successfully treated and go on to live for many years.  The success rate goes down depending on the size of the tumor, whether the cancer has spread, and other factors.

This news comes almost two weeks to the day that my mother passed away, and one week exactly after she was laid to rest after a long battle with melanoma.  My doctor said that if you had to contract cancer and could choose which cancer you got, this would be one of the best choices because it's relatively easily treated and treatment has a high success rate.

What's in store for me from this point on begins with a pre-surgery certification by my primary doctor.  That happens tomorrow.  On October 7, the surgeon will remove my thyroid and any surrounding tissue that looks abnormal. There are risks to the surgery, including changes to my voice or possible damage to calcium-processing glands near the thyroid, along with all the usual surgery risks.  I'll spend one night in the hospital, unless there are complications, which aren't likely.  After that, I'll spend 3-5 days at home recovering.  At some point I'll be given radioactive iodine.  They do this because the cells in this particular cancer respond like normal thyroid cells, which absorb iodine readily.  Any cancerous cells missed by the surgeon should, at least in theory, gobble up this radioactive iodine and die off.  After that, I should be cancer free and continue to live a normal life span, I'm told.

Somewhere in all this process, I'll begin taking synthetic thyroid hormone to replace what I would have gotten from the now-missing thyroid.  It will take some time to adjust the dosage to the right level for me, after which I'll take that medication for the rest of my days.

As I understand this, the only way the prognosis could get "bad" is if this cancer has spread beyond the thyroid, into the bones or other organs.  At this point, there's no evidence that is the case, and I should be fine.  I'll know for sure (hopefully) within a couple of weeks.

My Mother

| No Comments | No TrackBacks
About two years ago, my mother was diagnosed with melanoma.  It began, oddly, in one of her feet and spread from there. It traveled to lymph nodes, other places in her leg, and eventually produced an abdominal tumor large enough to shut off a kidney.  Last week, she began experiencing excruciating pain in her leg and had to be taken to the emergency room in an ambulance.  My dad called me last Wednesday to tell me that things didn't look good, and that I should get there soon. The next morning, he called me at work to tell me she didn't have long and I needed to get there right away.  I called my brother, who met me at my home and we began the 7 hour journey to York, PA.

Unfortunately, before we had left Ohio, mom had passed away.  We were (and still are) devastated by the news.

Because my parents had lived in York for so many years, a funeral service was held there. I had the opportunity to see just how many others' lives my mom had touched.  It was one of the most well-attended funerals I've ever seen.  It was comforting to see how many people cared about her and my father, and yet sad to see how many would miss her.

A second funeral service was held in Portsmouth, Ohio, yesterday.  It was as well-attended as the service in York.  People from as far away as Seattle and Arizona were there.  Mom was buried yesterday afternoon.

To say I will miss her is an understatement.  We spent hours on the phone over the years, talking about what each of us were doing that week.  She would tell me about people she had met at work (before she retired), quilts she was working on, what her dog Fozzy was up to, and a million other things.  She was quite a talker!  What I wouldn't give for one of those phone calls about now.

Mom was pretty amazing.  She was very well read, certainly more well read than I am.  She enjoyed doing crossword puzzles, making quilts, baking, traveling, and showering Fozzy with affection.  She'd lived in Brazil, in the Philippines, Georgia, Ohio, and Pennsylvania over her lifetime.  She was incredibly creative, having made more quilts over the years than any of us could count, done macrame, home decorating, gardening, and more.  I can only marvel at her life and accomplishments.

Life can be pretty painful sometimes, and this has been one of those times.  I'm moving forward as best I can, but I still picture her lying in rest at the funeral home, and it brings tears to my eyes.  I expect that will be the case for a while.  Someone told me at the funeral in York that people tell you time heals all wounds, but it's not true.  You just learn to live with the pain and focus on the good things your departed loved ones brought to your life.  That's probably true enough.

The Chrome Browser - Google's First "Evil"?

| No Comments | No TrackBacks

One of the things Google is famous for is a saying along the lines of "don't do anything evil" which is to sum up their attitude as a company. Earlier today, they released the "Chrome" web browser for Windows, a new approach to how browsers should work and designed from the ground up to handle web-based applications.

Having spent a few minutes with the browser, and keeping in mind it's a beta, I'm reasonably impressed. It seemed to be quick, properly rendered the pages I pointed it to, and didn't gobble up lots of system resources in the process. However, being a Windows administrator, I have a couple of problems with it.

Chrome doesn't install in the typical "C:\Program Files" location where (by default) applications are supposed to be installed. Instead, Chrome installs in the "C:\Documents and Settings" directory for the person who runs the installer. That's weird, and not something I'd expect from Google. Still, in and of itself, it's not exactly "evil".

The "evil" thing about Chrome is that it not only doesn't respect the "C:\Program Files" default installation location (and doesn't let the person installing it change that location), because it chooses to install in the "C:\Documents and Settings" directory it bypasses the normal protections against unauthorized users installing software on a system. Normally, a user requires administrator permission to install a software package like Internet Explorer, FireFox, or OpenOffice.org. Corporations rely on this to ensure their systems contain only licensed, authorized software. They rely on it to prevent unauthorized and potentially dangerous software from making it onto their systems. Using "Documents and Settings" as a way to get around these protections is, in my view, pretty "evil" and certainly beneath Google.