<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>(iBoyd)</title>
	<atom:link href="http://iboyd.net/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://iboyd.net</link>
	<description></description>
	<lastBuildDate>Tue, 23 Apr 2013 16:12:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Testing for Blocked UDP Ports</title>
		<link>http://iboyd.net/index.php/2013/04/22/testing-for-blocked-udp-ports/</link>
		<comments>http://iboyd.net/index.php/2013/04/22/testing-for-blocked-udp-ports/#comments</comments>
		<pubDate>Tue, 23 Apr 2013 03:36:16 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[UDP]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=569</guid>
		<description><![CDATA[Firewalls: A love-hate relationship. When the firewall administrator has the appropriate exceptions in place, it&#8217;s mostly protecting the one you love most. But when they don&#8217;t, it feels like betrayal. Alright, so my metaphor is off, but it is frustrating to find that, after hours of troubleshooting, that pesky application performance or availability issue was [...]]]></description>
				<content:encoded><![CDATA[<p>Firewalls: A love-hate relationship. When the firewall administrator has the appropriate exceptions in place, it&#8217;s mostly protecting the one you love most. But when they don&#8217;t, it feels like betrayal.</p>
<p>Alright, so my metaphor is off, but it is frustrating to find that, after hours of troubleshooting, that pesky application performance or availability issue was caused by a missing exception in a firewall somewhere between <em>Host A</em> and <em>Host B</em>. So more often than not, testing for a blocked port is on my troubleshooting short list these days.</p>
<p>So how does one test for a blocked port between two hosts? For TCP/IP ports, there are many options available, including nmap. But assuming the <em>listener</em> is running, I usually use a <a title="Use Telnet to Test TCP/IP Connections - Symantec" href="http://www.symantec.com/business/support/index?page=content&amp;id=TECH107919" target="_blank">telnet client to attempt to connect to the port</a>. An elegant test, it is not. But in most cases, it does the job just fine (<a title="Install Telnet Client - Technet" href="http://technet.microsoft.com/en-us/library/cc771275(v=ws.10).aspx" target="_blank">as long as you have a telnet client installed</a>).</p>
<p>But what about UDP ports? UDP is a different beast because it is a connectionless protocol. In other words, you can send something to the client, but don&#8217;t expect to receive a response indication of success in return. It&#8217;s true that you can sometimes determine whether a UDP port is open through <a title="UDP Port Scanning - Wikipedia" href="http://en.wikipedia.org/wiki/Port_scanner#UDP_scanning" target="_blank">alternate means</a>, but isn&#8217;t necessarily fool-proof. Instead, the method I use is to set up a listener on the UDP port in question on the receiving host and then UDP packets to that host and port from the sending host (that is, the host that typically does the sending the UDP packets). The best part is, I can do it all using two very simple PowerShell scripts. Below are the scripts, followed by instructions.</p>
<h3> Receive-UDPMessage.ps1</h3>
<pre class="brush: powershell;">#Waits for a UDP message on a particular port.
Param(
[parameter(Mandatory=$True,Position=0, HelpMessage='The host UDP port to send the message to')]
[Int]$Port,
[parameter(Mandatory=$False,Position=1, HelpMessage='If set, the function will continue listening for messages instead of exiting after the first one it receives. ')]
[switch]$Loop=$False
)

function Receive-UDPMessage{
[CmdletBinding(
    DefaultParameterSetName='Relevance',
    SupportsShouldProcess=$False 
)]
Param(
[parameter(Mandatory=$True,Position=0, HelpMessage='The host UDP port to send the message to')]
[Int]$Port,
[parameter(Mandatory=$False,Position=1, HelpMessage='If set, the function will continue listening for messages instead of exiting after the first one it receives. ')]
[switch]$Loop=$False
)
    try {
        $endpoint = new-object System.Net.IPEndPoint ([IPAddress]::Any,$port)
        $udpclient=new-Object System.Net.Sockets.UdpClient $port
        do  {

            Write-Host "Waiting for message on UDP port $Port..."
            Write-Host ""
            $content=$udpclient.Receive([ref]$endpoint)        
            Write-Host "Received: $content" 
            write-host "Received message: $([Text.Encoding]::ASCII.GetString($content))"
            Write-Host "Received from: $($endpoint.address.toString()):$($endpoint.Port)"

        } while($Loop)
    }catch [system.exception] {
        throw $error[0]

    } finally {
        $udpclient.Close()
    }

}

Receive-UDPMessage -Port $Port $Loop</pre>
<h3>Send-UDPMessage.ps1</h3>
<pre class="brush: powershell;">#Sends a message to a host on a particular port.

Param(
[parameter(Mandatory=$True,Position=0, HelpMessage='The host to send the message to')]
[String]$Hostname,

[parameter(Mandatory=$True,Position=1, HelpMessage='The message to send')]
[String]$Message,

[parameter(Mandatory=$True,Position=2, HelpMessage='The host UDP port to send the message to')]
[Int]$Port
)

function Send-UDPMessage{
[CmdletBinding(
    DefaultParameterSetName='Relevance',
    SupportsShouldProcess=$False 
)]
Param(
[parameter(Mandatory=$True,Position=0, HelpMessage='The host to send the message to')]
[String]$Hostname,

[parameter(Mandatory=$True,Position=1, HelpMessage='The message to send')]
[String]$Message,

[parameter(Mandatory=$True,Position=2, HelpMessage='The host UDP port to send the message to')]
[Int]$Port
)
Write-Host "Message to send: $Message"
$udpclient=new-Object System.Net.Sockets.UdpClient
$b=[Text.Encoding]::ASCII.GetBytes($Message)
$bytesSent=$udpclient.Send($b,$b.length,$Hostname, $Port)
write-host "Sent: $b"
$udpclient.Close()

}

Send-UDPMessage -Hostname $Hostname -Message $Message -Port $Port</pre>
<p>Using these scripts is simple:</p>
<ul>
<li>First, you run Receive-UDPMessage.ps1 on the receiving host like so:<br />
<a href="http://iboyd.net/wp-content/uploads/2013/04/Receive-UDPMessage.png" rel="lightbox[569]"><img class="alignnone size-full wp-image-572" alt="Receive-UDPMessage Screenshot" src="http://iboyd.net/wp-content/uploads/2013/04/Receive-UDPMessage.png" width="524" height="99" /></a><br />
<strong>Note:</strong> If the script can&#8217;t bind to the port because it is being used by another application, it will throw an error. If that happens, you will need to temporarily stop that application.</li>
<li>Next, you run Send-UDPMessage.ps1 on the sending host like so:<br />
<a href="http://iboyd.net/wp-content/uploads/2013/04/Send-UDPMessage.png" rel="lightbox[569]"><img class="alignnone size-full wp-image-571" alt="Send-UDPMessage Screenshot" src="http://iboyd.net/wp-content/uploads/2013/04/Send-UDPMessage.png" width="563" height="152" /></a></li>
<li>If UDP port isn&#8217;t blocked, the receiving host should get the message the script will end. If it is blocked, you&#8217;ll get nothing.<br />
<a href="http://iboyd.net/wp-content/uploads/2013/04/Receive-UDPMessage-Success.png" rel="lightbox[569]"><img class="alignnone size-full wp-image-581" alt="Receive-UDPMessage-Success" src="http://iboyd.net/wp-content/uploads/2013/04/Receive-UDPMessage-Success.png" width="595" height="164" /></a></li>
</ul>
<p>For a sanity check, you can also  try running both scripts on the same host to confirm it works (use <em>localhost</em> for the Hostname parameter).</p>
<p>Before I run off and claim sole credit for these scripts, I need to say that the original idea for them came from <a title="Powershell UDP Client Server" href="http://winpowershell.blogspot.com/2010/01/powershell-udp-clientserver.html" target="_blank">this page</a>. I merely refined things a bit. Best of luck with your UDP troubleshooting!</p>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2013/04/22/testing-for-blocked-udp-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Applying KB2506143 to an offline Windows 7 SP1 WIM = Windows Setup fail</title>
		<link>http://iboyd.net/index.php/2013/01/04/applying-kb2506143-to-an-offline-windows-7-sp1-wim-windows-setup-fail/</link>
		<comments>http://iboyd.net/index.php/2013/01/04/applying-kb2506143-to-an-offline-windows-7-sp1-wim-windows-setup-fail/#comments</comments>
		<pubDate>Fri, 04 Jan 2013 17:36:24 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[OS Deployment]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=555</guid>
		<description><![CDATA[We use the offline servicing features of the Windows Automated Installation Kit (WAIK) to patch our images. It&#8217;s a great feature that usually saves us time and enables us to update images without constantly unsealing and resealing. But after applying the latest and greatest patches to a base Windows 7 SP1 WIM yesterday and then [...]]]></description>
				<content:encoded><![CDATA[<p>We use the offline servicing features of the Windows Automated Installation Kit (WAIK) to patch our images. It&#8217;s a great feature that <em>usually</em> saves us time and enables us to update images without constantly unsealing and resealing. But after applying the latest and greatest patches to a base Windows 7 SP1 WIM yesterday and then testing it, I began to encounter this dreaded error during Windows Setup:</p>
<blockquote><p>Windows could not configure one or more system components. To install Windows, restart the computer and then restart the installation.</p></blockquote>
<p>Bummer. Fortunately, since the image was serviced offline and nothing else had changed, I could reasonably assume that one of the patches was the culprit. But which one? To find out, I rebooted the system into Windows PE and opened C:\Windows\Panther\setuperr.log. Here&#8217;s what I found&#8230;</p>
<pre class="brush:plain">2013-01-03 18:11:12, Error                 CSI    000000fb (F) Done with generic command 8; CreateProcess returned 0, CPAW returned S_OK
    Process exit code 4294967295 (0xffffffff) resulted in success? FALSE
    Process output: [l:117 [117]"ERROR - .NET 4.0 is not installedERROR - CLRCreateInstance call failed, 0x80004001.
ERROR - Initialization failed.
"][gle=0x80004005]
2013-01-03 18:11:12, Error      [0x018007] CSI    000000fd (F) Failed execution of queue item Installer: Generic Command ({81a34a10-4256-436a-89d6-794b97ca407c}) with HRESULT HRESULT_FROM_WIN32(14109).  Failure will not be ignored: A rollback will be initiated after all the operations in the installer queue are completed; installer is reliable (2)[gle=0x80004005]
2013-01-03 18:11:14, Error                 CSI    00000107 (F) Done with generic command 9; CreateProcess returned 0, CPAW returned S_OK
    Process exit code 4294967295 (0xffffffff) resulted in success? FALSE
    Process output: [l:117 [117]"ERROR - .NET 4.0 is not installedERROR - CLRCreateInstance call failed, 0x80004001.
ERROR - Initialization failed.
"][gle=0x80004005]</pre>
<p>It turns out that one of the updates that was installed in the offline WIM had a .NET 4.0 dependency, but the base Windows 7 SP1 image does not have .NET 4.0 installed. I would have expected the DISM utility to simply detect that .NET 4.0 was a prerequisite and skip over the update, but apparently it didn&#8217;t, or maybe there&#8217;s an issue with the update itself. At any rate, there&#8217;s no way to inject .NET 4.0 into an offline image &#8211; it requires unsealing, installing .NET 4.0, and resealing. Instead, I opted to remove the misbehaving update. To figure out which one it was, I opened setupact.log and looked for additional details that weren&#8217;t in the error log. I found these lines prior to one of the errors:</p>
<pre class="brush:plain">2013-01-03 18:11:12, Info                  CSI    000000f2 Begin executing advanced installer phase 38 (0x00000026) index 59 (0x0000003b) (sequence 98)
    Old component: [l:0]""
    New component: [ml:344{172},l:342{171}]"Microsoft.PowerShell.Commands.Utility-Gac.Resources, Culture=en-US, Version=7.1.7601.16398, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=x86, versionScope=NonSxS"
    Install mode: install
    Installer ID: {81a34a10-4256-436a-89d6-794b97ca407c}
    Installer name: [15]"Generic Command"</pre>
<p>Using <a title="Google search for Microsoft.PowerShell.Commands.Utility and  version 7.1.7601.16398" href="http://www.google.com/search?q=Microsoft.PowerShell.Commands.Utility%207.1.7601.16398" target="_blank">Google-fu</a>, I was able to determine that the failing component was part of <a title="KB2506143" href="http://support.microsoft.com/kb/2506143" target="_blank">KB2506143</a>: Windows Management Framework 3.0 for Windows 7 SP1 and Windows Server 2008 R2 SP1. From there, I just needed to mount the WIM and remove the update using DISM:</p>
<pre class="brush:plain">dism /image:TEMP\entx64mount /remove-package /packagepath:Updates\x64\Windows6.1-KB2506143-x64.cab</pre>
<p>After that, Windows Setup continued happily ever after</p>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2013/01/04/applying-kb2506143-to-an-offline-windows-7-sp1-wim-windows-setup-fail/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Recovering Data from a Failing Bitlocker Hard Drive</title>
		<link>http://iboyd.net/index.php/2012/09/08/recovering-data-from-a-failing-bitlocker-hard-drive/</link>
		<comments>http://iboyd.net/index.php/2012/09/08/recovering-data-from-a-failing-bitlocker-hard-drive/#comments</comments>
		<pubDate>Sat, 08 Sep 2012 21:34:23 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[BitLocker]]></category>
		<category><![CDATA[Data Recovery]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Ddrescue]]></category>
		<category><![CDATA[RIPLinux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=517</guid>
		<description><![CDATA[I was working on my laptop a few weeks ago, minding my own business, when processes suddenly started hanging left and right. I opened resource monitor (which itself took a painfully long time to load) and found the hard disk response times to be in the hundreds of thousands of milliseconds &#8211; normally, disk response [...]]]></description>
				<content:encoded><![CDATA[<p>I was working on my laptop a few weeks ago, minding my own business, when processes suddenly started hanging left and right. I opened resource monitor (which itself took a painfully long time to load) and found the hard disk response times to be in the hundreds of thousands of milliseconds &#8211; normally, disk response times are under 100ms unless under heavy load. When response times are this high, it&#8217;s a good indicator that something is <em>very</em> wrong, and my first instinct was that my hard drive has just started to fail. Sure enough, I powered cycled the system and could no longer boot into Windows and instead received an error &#8211; <em>0xc00000e9: An unexpected I/o Error has occurred</em>. Trying safe mode produced the same error message. Ugh.</p>
<p>Normally, to recover files from a failing drive that still has its filesystem intact, I would pull the drive, hook it up to a working system, and start copying files, skipping over files and directories that I didn&#8217;t need or that produced IO errors. With this drive, things were a bit different. The drive is Bitlocker enabled, which meant that in ordre to retrieve files, the drive needed to be unlocked or decrypted on a Bitlocker-aware system (i.e. one with Windows 7), using the Bitlocker recovery key to decrypt the data.</p>
<p>The good news is that I didn&#8217;t have anything important on the drive that wasn&#8217;t backed up, so I wasn&#8217;t desperate to recover its contents. But this was the first failed Bitlocker-enabled drive I&#8217;d encountered, and I thought it was a great opportunity to experiment to see how data on an encrypted drive can be recovered. It turns out that this can be a bit challenging on a failing drive where the success of IO operations isn&#8217;t always consistent, but it&#8217;s certainly possible to do.</p>
<h2>Using the Explorer GUI</h2>
<p>After removing the dying drive from the laptop, I connected it to another Windows 7 workstation using a USB-to-SATA adapter. The drive appeared in My Computer and even had the &#8220;Lock&#8221; icon next to it, indicating that it was a BitLocker drive:<br />
<a href="http://iboyd.net/wp-content/uploads/2012/08/BL-Recovery-Locked-Drive.png" rel="lightbox[517]"><img class="size-full wp-image-521 alignnone" title="Bitlocker Locked Drive" src="http://iboyd.net/wp-content/uploads/2012/08/BL-Recovery-Locked-Drive.png" alt="" width="265" height="62" /></a><br />
Double-clicking the drive icon in My Computer launched Wizard to unlock/decrypt the drive, which then prompted me to enter my BitLocker recovery key (if you don&#8217;t have this, I think you&#8217;re screwed).</p>
<p><a href="http://iboyd.net/wp-content/uploads/2012/08/BL-Recovery-Unlock-GUI.png" rel="lightbox[517]"><img class="size-full wp-image-522" title="BitLocker Drive Recovery Key GUI" src="http://iboyd.net/wp-content/uploads/2012/08/BL-Recovery-Unlock-GUI.png" alt="" width="549" height="455" /></a></p>
<p>I proceeded to enter the key and hit Next. At that point, the interface stopped responding and I was unable to kill the process through task manager, or even by initiating a system restart. Disconnecting the drive didn&#8217;t help either. Eventually, I used the power button on the workstation to power cycle the system. After the power cycle, I tried again and encountered the same behavior. At this point, it seemed like the failing drive was too damaged to use this method, so I went searching for other ways that I might unlock or decrypt the drive.</p>
<h2>Manage-bde</h2>
<p>After some searching, I found the Windows command line utility, <a title="Technet: Manage-bde" href="http://technet.microsoft.com/en-us/library/ff829849%28v=ws.10%29.aspx" target="_blank">Manage-bde</a>. Among other things, this utility can be used to unlock a Bitlocker drive. To do so, I launched PowerShell with administrative rights and enterred the following command:</p>
<pre class="brush:plain">manage-bde -unlock I: -RecoveryPassword 123456-123456-123456-123456-123456-123456-123456-123456</pre>
<p>The result looked promising:</p>
<p><a href="http://iboyd.net/wp-content/uploads/2012/08/BL-Recovery-Manage-BDE-Unlock1.png" rel="lightbox[517]"><img class="alignnone size-full wp-image-523" title="Manage-bde Unlock Successful" src="http://iboyd.net/wp-content/uploads/2012/08/BL-Recovery-Manage-BDE-Unlock1.png" alt="Manage-bde Unlock - The password successfully unlocked volume I:" width="990" height="94" /></a></p>
<p>Unfortunately, when I went to access the drive from My Computer, explorer froze and the contents of the root folder never appeared. Once again, it took a power cycle to get things working correctly. Why might this be? My guess is that there is a kernel-mode driver that&#8217;s used when mounting Bitlocker drives and doesn&#8217;t handle disk read timeouts very well, but I didn&#8217;t go into any in-depth debugging to confirm this. After all, strange things are expected to happen when a drive begins to fail.</p>
<h2>Repair-bde</h2>
<p>Since Manage-bde failed, I decided to try another command line utility for Bitlocker disks, <a title="Technet: Repair-bde" href="http://technet.microsoft.com/en-us/library/ff829851%28v=ws.10%29.aspx" target="_blank">Repair-bde</a>. Unlike Manage-bde, Repair-bde appears to be specifically designed for accessing data from a damaged Bitlocker disk:</p>
<blockquote><p>Accesses encrypted data on a severely damaged hard disk if the drive was encrypted by using BitLocker. Repair-bde can reconstruct critical parts of the drive and salvage recoverable data as long as a valid recovery password or recovery key is used to decrypt the data.</p></blockquote>
<p>Unlike Manage-bde, the Repair-bde utility does not include a command to unlock the drive. Instead, the contents of the drive are sequentially decrypted and copied to a separate volume or image. you can also write the decrypted contents back to the source disk itself, but this is definitely not recommended if the drive is damaged and/or failing. Below is the Repair-bde command I used:</p>
<pre class="brush:plain">repair-bde I: C:\Recovered.img -RecoveryPassword 123456-123456-123456-123456-123456-123456-123456-123456 -Force</pre>
<p>At first, this looked like it was going to work. The drive decryption process proceeded at a steady rate until it reached 17%, where the reads began to fail. With this particular drive, the read timeouts were excessive, taking 2+ minutes for each failed read to timeout. I tried <a title="Setting the Windows Disk Timeout" href="http://blogs.msdn.com/b/san/archive/2011/08/15/the-windows-disk-timeout-value-understanding-why-this-should-be-set-to-a-small-value.aspx" target="_blank">changing the disk timeout</a>, but the read timeout performance did not improve. Although I couldn&#8217;t find any definitive answers through online research, it seems like many SATA drives have have a firmware-based timeout. It turns out that some hard disk drives enforce a timeout in their firmware. In some cases, the firmware timeout can be adjusted (possibly through the <a title="Wikipedia: Error Recovery Control" href="http://en.wikipedia.org/wiki/Error_recovery_control" target="_blank">ERC/TLER/CCTL</a> setting?). For this disk, it wasn&#8217;t possible.</p>
<p>I let repair-bde run overnight, but the next morning it was still at 17%. Since I had no idea how many bad or unreadable sectors were on the disk, I imagine it would have taken weeks to complete at this pace. It would be ideal if Repair-bde could skip over sections of the disk, but I could not find an option for doing so.</p>
<h2>RIPLinux and ddrescue</h2>
<p>At this point, I decided it was time to change my strategy. The main problem was that disk timeouts were making it impossible to recover data using Repair-bde, and were probably factoring into to the issues I had when unlocking the drive with Manage-bde. I reasoned that, if I could capture recoverable parts of the disk into an image, I should be able to mount it in Windows and then unlock it. I started looking at ways to capture the raw (encrypted) data from the disk. I came across a <a title="Data Recovery" href="http://wiki.lunarsoft.net/wiki/Data_Recovery" target="_blank">wiki page</a> that contained information about a Linux distribution called <a title="RIP Linux" href="http://www.tux.org/pub/people/kent-robotti/looplinux/rip/" target="_blank">RIPLinux</a>, which included a tool named <a title="DDRescue" href="http://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html" target="_blank">ddrescue</a>. Ddrescue performs a sector-by-sector copy of a disk. This is something that many other imaging utilities are capable of doing. However, ddrescue is much more resilient. Where other imaging tools will choke and die on bad sectors (*cough* Ghost), ddrescue gracefully recovers from an encounter with an unreadable sector, and skips ahead to another group of sectors. After an initial pass, it can then go back and retry the skipped sectors in smaller groups, maximizing the amount data that is recovered.  The more passes performed, the more data retrieved (and the more time it takes to run &#8211; days or even weeks depending on state of the drive). Even better, ddrescue is restartable. If your capture is interrupted, simply type the same command as before (pointing to the associated ddrescue log), and it picks up right where it left off.</p>
<p>In brief, here are the steps you can follow to use this tool:</p>
<ol>
<li>Download the <a title="RIP Linux" href="http://www.tux.org/pub/people/kent-robotti/looplinux/rip/">RIPLinux ISO</a> and the <a title="Universal USB Installer" href="http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3">Universal USB Installer</a> (alternatively, you can skip step 2 and burn the ISO to CD instead)</li>
<li>Connect an empty USB drive (it will be formatted), launch Universal USB Installer, select RIPLinux as the distribution, browse to the RIPLinux ISO you downloaded, then click Create</li>
<li>Connect the bad drive, and an empty good drive of equal or greater size to your &#8220;recovery system&#8221; and boot from the USB drive or CD containing RIP Linux.</li>
<li>At the login prompt, type &#8216;root&#8217; and press enter. You&#8217;ll need to identify and drives now, which is arguably the most difficult part of this process if you&#8217;re a Linux novice.
<ol>
<li>At the shell prompt, type: fdisk -l</li>
<li>Identify and write down the device names for the bad drive and the good drive based on output of fdisk &#8211; l. For example, the first disk is usually /dev/sda and the second disk might be /dev/sdb. Ignore the partition names (i.e. /dev/sda1), if there are any.  <strong>Tip:</strong> To scroll up and down in the console: Shift + Page Up and Shift + Page Dn</li>
<li>Check, double check.<strong> It is very important that you correctly identify these disks!</strong>  Getting them mixed up could mean accidentally overwriting data on the bad drive! If you&#8217;re unsure, you can use the parted -l command, which lists the model of each drive in addition to its partitions.</li>
</ol>
</li>
<li>Run ddrescue:
<pre class="brush:plain">ddrescue /bad/drive /good/drive rescue.log -r -1 -a 10000 -d</pre>
<p><strong>-r -1</strong> = Retry infinity times<br />
<strong>-a 10000</strong>  = Sets minimum read rate to 10,000 bytes. If the read rate goes below this, ddrescue will skip ahead a variable amount, and mark that area for retry on the next pass (if you choose to do one)<br />
<strong>-d</strong> = Use direct disk access<br />
There are many other <a title="ddrescue manual" href="http://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html" target="_blank">options</a>, so feel free to change things up a bit.</li>
<li>Wait for ddrescue to complete a pass &#8211; this will take a while. After the pass completes, you can see how much data ddrescue has recovered. If you&#8217;re satisfied, you might stop here. Otherwise, you can perform another pass, and ddrescue will try to recover as much of the parts it skipped over as possible. The more passes run, the more data that should be recovered &#8211; though the returns will usually be lower with each pass.</li>
</ol>
<p>With ddrescue finished, connect the good drive to a Windows 7 system. If all goes well, Windows should detect that the drive is BitLocker-encrypted, and you should be able to unlock it by double clicking the drive in My Computer and supplying your recovery key. You can also try the repair-bde commands mentioned above if this doesn&#8217;t work.</p>
<div id="attachment_546" class="wp-caption alignnone" style="width: 272px"><a href="http://iboyd.net/wp-content/uploads/2012/09/BL-Recovery-Unlocked-Drive.png" rel="lightbox[517]"><img class="size-full wp-image-546" title="BL-Recovery-Unlocked-Drive" src="http://iboyd.net/wp-content/uploads/2012/09/BL-Recovery-Unlocked-Drive.png" alt="" width="262" height="65" /></a><p class="wp-caption-text">Achievement Unlocked.</p></div>
<p>If you&#8217;d prefer to write the recovered contents of the disk to a disk image, you can do that. In fact, that&#8217;s actually what I did in my case so that I could also write the ddrescue log file to the same disk and transfer the image to other storage. To do so, there&#8217;s a few Linux-specific commands involved. I forgot to save the specific commands (doh!), but here are the general steps:</p>
<ol>
<li>Format the good drive with the Linux EXT3 filesystem, then mount it. I originally tried to write the image to an NTFS-formatted drive, but the Linux NTFS driver was slow and maxed out the CPU when I tried it initially &#8211; it doesn&#8217;t handle writing to large sparse files very well.</li>
<li>Run ddrescue, pointing to a non-existent file on the mounted drive. For example:
<pre class="brush:plain">ddrescue /dev/sdc /mnt/sdb1/disk.img /mnt/sdb1/rescue.log -r -1 -a 10000 -d --extend-outfile=150G</pre>
</li>
<li>After ddrescue runs, mount the good drive on a Windows 7 system. Since Windows doesn&#8217;t recognize EXT filesystems natively, you&#8217;ll need to grab <a title="Ext2Fsd Project" href="http://www.ext2fsd.com/" target="_blank">Ext2Fsd</a> to mount it.</li>
<li>Use <a title="VHD Tool" href="http://archive.msdn.microsoft.com/vhdtool" target="_blank">VHD tool</a> to convert the the raw disk image to a VHD.</li>
<li>Mount the VHD using Diskpart. From a command prompt, type Diskpart.exe to run diskpart, then run these commands:
<pre class="brush:plain">select vdisk file=disk.vhd
attach vdisk
assign letter=Z</pre>
</li>
<li>If everything worked, the drive should appear in My Computer and you can unlock it and recover your files.</li>
</ol>
<p>&nbsp;</p>
<h2>Other Thoughts</h2>
<ul>
<li>I prefer to remove failing drives from their enclosure and either place a fan on them or put them in a cooler with ice to keep them cool. A hot failing drive is bad. Obviously, if you put the drive on ice, be sure to come up with a way to keep it dry. A wet failing drive is bad.</li>
<li>You may have heard that putting drives in the freezer overnight can sometimes revive them just long enough. This may be true, but in my case it wasn&#8217;t. It&#8217;s probably moot if you&#8217;re trying to capture an image of the entire drive, since the drive won&#8217;t stay cool long enough to complete the image capture. It might work better if you could keep the drive in the freezer while recovering data, but I&#8217;ve never tried this.</li>
<li>Remember, when you&#8217;re working on any failing drive, you&#8217;re on borrowed time. Chances are good that the drive&#8217;s health will continue to deteriorate, so get as much data as you can, then get out. In many cases, it makes sense to capture the contents of the drive with something like ddrescue BEFORE trying any of the other methods, in case the drive becomes completely unresponsive to IO requests during subsequent recovery attempts or additional sectors go bad.</li>
<li>I <strong>would not </strong>run chkdsk /r on a failing drive, or use any software that will attempt to write to the drive.  Writing to a failing drive = bad.</li>
</ul>
<h2></h2>
<p>RIPLinux and Ddrescue are fantastic tools to have in your data recovery arsenal, and proved crucial in the recovery of data from my dying BitLocker drive. It <strong>is not</strong> a substitute for backing up your data, but you already knew that. Hopefully, this writeup will be useful to others that need to rescue their data!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2012/09/08/recovering-data-from-a-failing-bitlocker-hard-drive/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Updated Dell Warranty Information Script</title>
		<link>http://iboyd.net/index.php/2012/02/14/updated-dell-warranty-information-script/</link>
		<comments>http://iboyd.net/index.php/2012/02/14/updated-dell-warranty-information-script/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 23:09:18 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[dell warranty information]]></category>
		<category><![CDATA[jigsaw]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[warranty lookup]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=449</guid>
		<description><![CDATA[Recently, Dell made some changes to their support website that broke the Dell Warranty Information Script. After investigating the changes, I determined that the new warranty information URL does not accept the service tag as a URL parameter, or at least it doesn&#8217;t appear to. Instead, the service tag is retrieved from a cookie that [...]]]></description>
				<content:encoded><![CDATA[<p>Recently, Dell made some changes to their support website that broke the <a title="iBoyd Dell Warranty Information Script" href="http://iboyd.net/index.php/2010/06/17/dell-warranty-information-script/" target="_blank">Dell Warranty Information Script</a>. After investigating the changes, I determined that the new <a title="Dell Warranty Information URL" href="http://www.dell.com/support/troubleshooting/us/en/555/TroubleShooting/Display_Warranty_Tab" target="_blank">warranty information URL</a> does not accept the service tag as a URL parameter, or at least it doesn&#8217;t appear to. Instead, the service tag is retrieved from a cookie that is generated when you enter the tag on <a title="Dell Product Selector Page" href="http://www.dell.com/support/troubleshooting/us/en/555/ProductSelector" target="_blank">this page</a>. Good grief.</p>
<p>Scripting the cookies and passing them is probably possible, but I felt it was stretching the solution too far, so I adapted the script to use the undocumented SOAP web service instead. The script is below.</p>
<p>There are several things that I dislike about <a title="Dell AssetService Web Service" href="http://xserv.dell.com/services/assetservice.asmx" target="_blank">Dell&#8217;s AssetService</a> web service:</p>
<ol>
<li>It&#8217;s completely undocumented, and no one really knows what the guid and applicationName parameters are meant to do. I haven&#8217;t found anything indicating that it&#8217;s even a production service.</li>
<li>The descriptions returned for each entitlement (warranty record) aren&#8217;t as well formatted.</li>
<li>Sometimes, it doesn&#8217;t return the list of entitlements, so the script needs to be run again until it does.</li>
</ol>
<p>Alas, this is going to have to work for now until a better solution presents itself. If you&#8217;ve found a better solution, please share in the comments.<br />
<span id="more-449"></span></p>
<pre class="brush: vb">'=====================================================================
'    Dell Warranty Grabber
'    Author:     Matthew Boyd (iboyd.net)
'    Date:        2/14/2012
'
'    This is  an example of how to query the Dell asset information
'    web service for warranty information and parse the XML result.
'    values are then written to the registry of the local
'    computer. FYI: Sometimes, the web service doesn't return any
'    entitlements (warranties), but then returns them after
'    subsequent requests.
'
'    Usage:    cscript.exe DellWarrantyGrabber.vbs
'
'    Note: This must be run under an account with admin rights.
'    This script is provided AS IS with no support or warranties.
'    Use at your own risk!
'=====================================================================
Option Explicit
Dim SoapRequest
Dim url, regkey, svctag
Dim warrantyRows, warrantyCols
Dim objShell, objXML, objWMI, objHTTP, NodeList
Dim i, result

SoapRequest = "&lt;?xml version=""1.0"" encoding=""utf-8""?&gt; &lt;soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""&gt; &lt;soap:Body&gt; &lt;GetAssetInformation xmlns=""http://support.dell.com/JigsawWebServices/""&gt; &lt;guid&gt;11111111-1111-1111-1111-111111111111&lt;/guid&gt; &lt;applicationName&gt;Warranty Information Lookup&lt;/applicationName&gt; &lt;serviceTags&gt;!SERVICETAG!&lt;/serviceTags&gt; &lt;/GetAssetInformation&gt; &lt;/soap:Body&gt;&lt;/soap:Envelope&gt;"

url = "http://xserv.dell.com/jigsawwebservices/AssetService.asmx"
regkey = "HKEY_LOCAL_MACHINE\Software\DellWarrantyInfo"
set objShell = WScript.CreateObject("WScript.Shell")
set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

If InStr(UCase(objWMI.ExecQuery("Select Manufacturer From Win32_ComputerSystem").ItemIndex(0).Manufacturer), "DELL") = 0 then Err.Raise 2, "This is not a Dell dude!", "No Service Tag"

svctag = Trim(objWMI.ExecQuery  ("Select SerialNumber from Win32_BIOS").ItemIndex(0).SerialNumber)

wscript.echo "Service Tag: " &amp; svctag
SoapRequest = Replace(SoapRequest, "!SERVICETAG!", svctag)
result = objShell.Run("reg.exe delete '" &amp; regkey &amp; "' /f", true)
If not result = 0 then Err.Raise result, "Unable to delete registry key!", "Code " &amp; result

result = objShell.Run("reg.exe create '" &amp; regkey &amp; "' /ve", true)
If not result = 0 then Err.Raise result, "Unable to delete registry key!", "Code " &amp; result

Set objHTTP = CreateObject("Msxml2.XMLHTTP")
objHTTP.open "POST", URL, false
objHTTP.setRequestHeader "Content-Type", "text/xml"
objHTTP.setRequestHeader "SOAPAction", "http://support.dell.com/JigsawWebServices/GetAssetInformation"
objHTTP.send SoapRequest

result = objHTTP.responseText

Set objXML = CreateObject ("Msxml2.DOMDocument")
objXML.LoadXml result

If not objXML.SelectSinglenode ("//faultstring") is nothing then
    Err.Raise 1,  "Error:" &amp; objXML.SelectSingleNode("//faultcode").text, Trim(objXML.SelectSingleNode("//faultstring").text)
End If
wscript.echo objXML.xml
Set NodeList = objXML.SelectNodes("//Asset/Entitlements/EntitlementData")
 wscript.echo NodeList.length &amp; " results returned: "

For i = 0 to NodeList.length - 1
set warrantyCols = NodeList.item(i)
wscript.echo Mid(warrantyCols.SelectSingleNode("ServiceLevelDescription").text,4)

objShell.regWrite regkey &amp; "\" &amp; i &amp; "\", ""
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Description", Mid(warrantyCols.SelectSingleNode("ServiceLevelDescription").text, 4)
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Provider", warrantyCols.SelectSingleNode("Provider").text
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Entitlement Type", warrantyCols.SelectSingleNode("EntitlementType").text
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Start Date", Left(warrantyCols.SelectSingleNode("StartDate").text, 10)
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\End Date", Left(warrantyCols.SelectSingleNode("EndDate").text, 10)
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Days Left", warrantyCols.SelectSingleNode("DaysLeft").text

Next</pre>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2012/02/14/updated-dell-warranty-information-script/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>Scripting a Scheduled Wakeup in Windows 7 (and Vista too!)</title>
		<link>http://iboyd.net/index.php/2010/10/15/scripting-a-scheduled-wakeup-in-windows-7-and-vista-too/</link>
		<comments>http://iboyd.net/index.php/2010/10/15/scripting-a-scheduled-wakeup-in-windows-7-and-vista-too/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 18:27:54 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[Power Management]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[power management]]></category>
		<category><![CDATA[scheduled wakeup]]></category>
		<category><![CDATA[standby]]></category>
		<category><![CDATA[task scheduler]]></category>
		<category><![CDATA[Wake-on-LAN]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=386</guid>
		<description><![CDATA[When it comes to implementing power saving settings on managed workstations, the easy part is configuring the power management settings themselves. The hard part is ensuring that the systems remain consistently managed and maintained. Once standby settings are configured in Windows Power Management, idle workstations are likely to enter standby overnight, which is great way [...]]]></description>
				<content:encoded><![CDATA[<p>When it comes to implementing power saving settings on managed workstations, the easy part is configuring the power management settings themselves. The hard part is ensuring that the systems remain consistently managed and maintained. Once standby settings are configured in Windows Power Management, idle workstations are likely to enter standby overnight, which is great way for conserving energy.  But the evening hours are also an ideal time to deploy software and updates, because it&#8217;s less disruptive to employees that use these workstations  throughout the day. How do you balance power savings, maintenance, and the end user experience on these systems?</p>
<p>Well, some people will tell you that Wake-on-LAN (WoL) is the solution. It&#8217;s true that, with WoL, you should be able to wake machines overnight to perform tasks &#8212; in theory at least. I say <em>in theory</em> because, any sysadmin that has tried to use WoL to wake and manage many workstations (100+) over multiple subnets will tell you that Wake-on-LAN is no magic bullet. There are several reasons for this:</p>
<ol>
<li>To wake up a workstation with Wake-on-LAN, the workstation&#8217;s network adapter must be properly configured to receive WoL&#8217;s <em>Magic Packets </em>(trust me, these packets are much less magical than their name implies)<em>. </em>This can be a lot more difficult than it sounds, especially if you need to script these settings for automated configuration.</li>
<li>In most environments, WoL packets will not work across subnets, so you need at least one device on each subnet that can send WoL packets. You&#8217;ll also need some sort of mechanism (usually software) to tell sender devices to send packets on their subnet to wake them up.</li>
<li>Many wireless network adapters do not support WoL, and the ones that do tend to have inconsistent results with receiving WoL packets. If you have workstations that only connect to the network via wireless, this is a problem.</li>
<li>If the workstation is disconnected from the LAN, the WoL packet won&#8217;t make it.</li>
</ol>
<h1>Scheduled Wakeups</h1>
<p>WoL is very useful for many situations, especially for impromptu wakeups. But if you want your workstations to wake from standby at night, or any time, you may not want to depend soley on WoL. What you really need is something that tells Windows to resume from standby on a schedule. But how? Well, Microsoft Windows actually includes the capability to resume from standby at certain times. This functionality is a part of the Task Scheduler service, and it can be enabled by simply clicking a check box:</p>
<p style="text-align: center;"><a href="http://iboyd.net/wp-content/uploads/2010/10/schedwake1.jpg" rel="lightbox[386]"><img class="aligncenter size-full wp-image-387" title="Wake the computer to run this task" src="http://iboyd.net/wp-content/uploads/2010/10/schedwake1.jpg" alt="" width="517" height="389" /></a></p>
<p>With the &#8220;Wake the computer to run this task&#8221; checkbox set on a scheduled task, the system will resume from standby at whatever time interval has been configured on the Triggers tab. It is important to note, however, that this won&#8217;t work if the system is completely powered off.</p>
<p>The next question is, what should the task do once it has woken up the system? The answer is, just about anything. For example, it could  run a script that starts Windows Update, run a virus scan, or start a backup. If you can script it or call it from the command line, you can do it. Here&#8217;s a simple example of how you might keep the system awake for at ~10 minutes by using the ping command:</p>
<p style="text-align: center;"><a href="http://iboyd.net/wp-content/uploads/2010/10/schedwake2.jpg" rel="lightbox[386]"><img class="aligncenter size-full wp-image-388" title="Scheduled task to ping something for ~10 minutes" src="http://iboyd.net/wp-content/uploads/2010/10/schedwake2.jpg" alt="" width="517" height="389" /></a></p>
<p style="text-align: left;">
<h1>Scripting Wakeups</h1>
<p>Alright, we can use a scheduled task to wake workstations. That&#8217;s great, but not very useful unless we can use a script to automate the creation of a task that does this. As you may already know, a scheduled task can be created with the command line utility: <a title="MSDN Documentation: SCHTASKS.EXE" href="http://msdn.microsoft.com/en-us/library/bb736357%28VS.85%29.aspx" target="_blank">SCHTASKS.EXE</a>. This is a relatively powerful utility for creating tasks, and once you understand all of the command line options, creating a task with this utility is fairly straightforward:</p>
<pre class="brush:plain">schtasks /create /TN "My Wakeup Task" /SC DAILY /ST 23:00 /TR "ping.exe 169.1.1.1 -n 600 -i 1 -w 1000" /RU "SYSTEM"</pre>
<p>Unfortunately, it appears as though there&#8217;s no way to set &#8220;Wake the computer to run this task&#8221; via SCHTASKS.  However, Windows Vista and 7 come with a robust <a title="MSDN: Task Scheduler API Reference" href="http://msdn.microsoft.com/en-us/library/aa383608%28v=VS.85%29.aspx" target="_blank">Task Scheduler API</a> that can configure this setting. I wrote a VB script that does just that:</p>
<pre class="brush: vb">'  Name:    ScheduledTaskSetWakeToRun.vbs
'  Author:    Matthew Boyd (iboyd.net)
'  Date:    10/13/2010
'  Purpose:    Enables or disables the "Wake the computer to run this task" setting on Windows Vista and Windows 7 systems.
'        It seems that in order to do this successfully, both in the GUI or via this script,the task compatibility
'        mode must be set to "2.0" or else the setting gets reverted.
'  Usage:    cscript.exe ScheduledTaskSetWakeToRun.vbs "" [enable | disable]
'  Example:    cscript.exe ScheduledTaskSetWakeToRun.vbs "My Scheduled Task" enable
'        The command above would set "Wake the computer to run this task" to enabled.

Option Explicit

Const TASK_UPDATE = &amp;H4
Const TASK_DONT_ADD_PRINCIPAL_ACE = &amp;H10

Dim TaskName, EnableWakeToRun, objTaskService, objRootFolder, objTask, objDefinition

If Wscript.Arguments.Count &lt; 1 Then
 Err.Raise 1, "Invalid command line arguments!"
Else
 TaskName = Wscript.Arguments.Item(0)
End If

Wscript.echo "Task Name: " &amp; TaskName
If Wscript.Arguments.Count &lt; 2 Then 'Set EnableWakeToRun to true by default if enable/disable was not specified.
 EnableWakeToRun = true
 wscript.echo "Action: ENABLE 'Wake the computer to run this task'"
ElseIf UCase(Wscript.Arguments.Item(1)) = "ENABLE" Then
 wscript.echo "Action: ENABLE 'Wake the computer to run this task'"
 EnableWakeToRun = true
Else
 wscript.echo "Action: DISABLE 'Wake the computer to run this task'"
 EnableWakeToRun = false
End If

Set objTaskService = CreateObject("Schedule.Service")
objTaskService.Connect
Set objRootFolder = objTaskService.GetFolder("\")
Set objTask = objRootFolder.GetTask ("\" &amp; TaskName)

Set objDefinition = objTask.Definition
wscript.echo "Current WakeToRun Setting: " &amp; CStr(objDefinition.Settings.WakeToRun)
wscript.echo "Current Compatibility Setting: " &amp; objDefinition.Settings.Compatibility
wscript.echo "---"
objDefinition.Settings.WakeToRun = EnableWakeToRun
objDefinition.Settings.Compatibility = 2
objRootFolder.RegisterTaskDefinition objTask.Name, objDefinition, TASK_UPDATE or  TASK_DONT_ADD_PRINCIPAL_ACE, , , objDefinition.Principal.LogonType

Set objTaskService = CreateObject("Schedule.Service")
objTaskService.Connect
Set objRootFolder = objTaskService.GetFolder("\")
Set objTask = objRootFolder.GetTask (TaskName)
wscript.echo "New WakeToRun Setting: " &amp; CStr(objTask.Definition.Settings.WakeToRun)
wscript.echo "New Compatibility Setting: " &amp; objDefinition.Settings.Compatibility
</pre>
<p>To use this script, create a task first by using SCHTASKS. Then, run a command similar to this:</p>
<pre class="brush:plain">cscript.exe ScheduledTaskSetWakeToRun.vbs "My Scheduled Task" enable</pre>
<p>The script will output both the previous and new values of the &#8220;WakeToRun&#8221; setting. You can verify that it worked by opening the Task Scheduler GUI and verifying that &#8220;Wake the computer to run this task&#8221; is set. This script can also be used to disable this setting.</p>
<p>You may also notice that the code in this script sets the &#8220;task compatibility mode&#8221; version to 2. I found issues with tasks that were using a different compatibility mode. It seems that &#8220;Wake the computer to run this task&#8221; would always be reverted, even if it was set through the Task Scheduler GUI. I believe the only disadvantage to changing the compatibility mode is that the task will not be backwards compatible with Windows XP.</p>
<p>By using a combination of Wake-on-LAN and scheduled wakeups, it&#8217;s much easier to successfully manage and maintain workstations in standby with better precision and accuracy. Also, by performing maintenance tasks overnight, you can keep workstations reliable without impacting the end user. It&#8217;s a win-win situation!</p>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2010/10/15/scripting-a-scheduled-wakeup-in-windows-7-and-vista-too/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>ATI Radeon Causes a UAC Prompt at User Logon</title>
		<link>http://iboyd.net/index.php/2010/06/29/ati-radeon-causes-a-uac-prompt-at-user-logon/</link>
		<comments>http://iboyd.net/index.php/2010/06/29/ati-radeon-causes-a-uac-prompt-at-user-logon/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 16:36:05 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[ATI radeon]]></category>
		<category><![CDATA[finish-install action]]></category>
		<category><![CDATA[UAC prompt]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=356</guid>
		<description><![CDATA[Recently, I encountered a strange issue after adding ATI Catalyst 10.4 Display Drivers to an offline Windows 7 image using the DISM.EXE /Add-Driver command. On systems that had an ATI Radeon video card, a UAC prompt would pop up the first time a user logged on and got to the desktop: Since our users don&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p>Recently, I encountered a strange issue after adding ATI Catalyst 10.4 Display Drivers to an offline Windows 7 image using the <em>DISM.EXE /Add-Driver</em> command. On systems that had an ATI Radeon video card, a UAC prompt would pop up the first time a user logged on and got to the desktop:</p>
<p><a href="http://iboyd.net/wp-content/uploads/2010/05/ati-radeon-uac-prompt.png" rel="lightbox[356]"><img class="aligncenter size-full wp-image-368" title="ATI Radeon UAC Prompt" src="http://iboyd.net/wp-content/uploads/2010/05/ati-radeon-uac-prompt.png" alt="" width="470" height="436" /></a></p>
<p><span id="more-356"></span>Since our users don&#8217;t have administrative rights they couldn&#8217;t complete this this operation, and the UAC prompt would continue to occur at every logon.  If I entered administrator credentials or logged in as an administrator, the UAC prompt went away for all users. But if I uninstalled the display adapter via Device Manager and scanned for hardware changes, the prompt came back. I proceeded to troubleshoot, but without much success:</p>
<ul>
<li>Everything in Setupapi.offline.log indicated that the driver was successfully added to the offline image.</li>
<li>The issue affected any system that had an ATI Radeon HD display adapter, regardless of the model.</li>
<li>I had used previous versions of ATI Catalyst display drivers, including  9.12, without any problems. As it turns out, the UAC prompt began  to appear beginning with Catalyst 10.1 and continued through the current version (10.6).</li>
<li>According to Device Manager, the display adapter was already installed and working properly. If I entered administrator credentials at the UAC prompt, no additional or new devices appeared in Device Manager.</li>
</ul>
<p>Maybe the UAC prompt doesn&#8217;t seem like a big deal, but when you have 5000+ computers that displaying this annoying prompt at every logon, going around to each one and entering administrator credentials isn&#8217;t an option. I opened a support case with our system vendor, but after a month without much progress, I started digging deeper on my own.</p>
<p>One thing that I had overlooked originally was setupapi.dev.log, which tracks hardware device installs. I opened this log on a system that exhibited the UAC prompt behavior and began sifting through the entries. I found the install section for the ATI Radeon device. At first, it looked liked everything was fine. The driver installed successfully and the section closed with [Exit status: SUCCESS]. I then began to read through every line to see if there were any other clues. Finally, I found something:</p>
<pre class="brush:plain"> dvi:      {DIF_NEWDEVICEWIZARD_FINISHINSTALL} 13:58:19.543
 dvi:           CoInstaller 1: Enter 13:58:19.543
 dvi:           CoInstaller 1: Exit
 dvi:           Class installer: Enter 13:58:19.543
 dvi:           Class installer: Exit
 dvi:           Default installer: Enter 13:58:19.606
 dvi:           Default installer: Exit
 dvi:      {DIF_NEWDEVICEWIZARD_FINISHINSTALL - exit(0xe000020e)} 13:58:19.606
 ndv:      Device has a Finish Install Action that needs to be run.</pre>
<p>The last line is what caught my attention. I searched through the rest of the log for the entry <em>Device has a Finish Install Action that needs to be run. </em>Sure enough,<em> t</em>he ATI display adapter was the only device that had this status. I began looking for more information about DIF_NEWDEVICEWIZARD_FINISHINSTALL. This eventually led me to the Windows DDK documentation, where I learned about<a title="How Finish-Install Actions Work" href="http://msdn.microsoft.com/en-us/library/ff546216.aspx" target="_blank"> Finish-Install Actions</a>:</p>
<blockquote><p>After core device installation is complete for a device, Windows  checks whether the CONFIGFLAG_FINISHINSTALL_ACTION flag or the  CONFIGFLAG_FINISHINSTALL_UI flag is set for the device. If either of  these flags is set for a device, Windows queues a finish-install process  that performs the finish-install actions specific to the device. The  process executes in the user&#8217;s context.</p>
<p>The finish-install process  runs only in the context of a user with administrator credentials at  one of the following times:</p>
<ul>
<li>The next time that a user who  has administrator credentials logs on while the device is attached.</li>
<li>When  the device is reattached.</li>
<li>When the user selects <strong>Scan  for hardware changes</strong> in Device Manager.</li>
</ul>
<p>If a user  is logged on without administrative privileges, Windows prompts the user  for consent and credentials to run the finish-install actions in an  administrator context.</p></blockquote>
<p>Arrrrrgh! It seems that this behavior is by design!? I&#8217;m not sure why I haven&#8217;t come across another driver that exhibits this behavior, or why ATI decided to implement this behavior beginning in Catalyst 10.1.</p>
<h2>The Finish-Install Action</h2>
<p>Next, I decided to use <a title="SysInternals Process Monitor" href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" target="_blank">Process Monitor</a> to figure out what the Finish-Install action was doing. With Process Monitor running, I entered administrative credentials into the UAC prompt and let the install complete. I then began filtering out irrelevant Process Monitor entries to find out what what was happening during the Finish-Install action. As far as I could tell, it was setting the registry value<em> INFName</em> under<em> HKLM\SOFTWARE\ATI Technologies\Co-installer</em> to the name of the INF that was used to install the driver. That&#8217;s it.</p>
<h2>Goodbye, Finish-Install Action</h2>
<p>Since this seems to have little, if any, impact on the functionality of the display driver, I began searching for a way to skip or disable the Finish-Install actions. I searched through the Windows DDK documentation and came up with nothing. I also had Google searches coming out the wazoo.</p>
<p>Finally, I used Process Monitor again to see if I had missed anything during the first try. It turns out I did: The registry value <em>ConfigFlags</em> under <em>HKLM\System\CurrentControlSet\Enum\PCI\VEN_1002&amp;DEV_9540&amp;SUBSYS_00021028&amp;REV_00\4&amp;10ef49db&amp;0&amp;0008</em> was being set to <strong>0&#215;0</strong>.  I went back and looked found that, after the display adapter is installed and before the UAC prompt, <em>ConfigFlags</em> is set to <strong>0&#215;00020000</strong>. As it turns out, this is the enumerated value for CONFIGFLAG_FINISHINSTALL_ACTION. I tried to modify the <em>ConfigFlags</em> value, but it turned out that only the SYSTEM account had permissions to do that. So I grabbed <a title="SysInternals PSExec" href="http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx" target="_blank">PSExec</a> and ran this command:</p>
<pre class="brush:plain">PSEXEC -s REG ADD HKLM\System\CurrentControlSet\Enum\PCI\VEN_1002&amp;DEV_9540&amp;SUBSYS_00021028&amp;REV_00\4&amp;10ef49db&amp;0&amp;0008 /v "ConfigFlags" /t REG_DWORD /d 0 /f
</pre>
<p>Finally, the UAC prompt went away.</p>
<p><strong>Note:</strong> If decide to try the command above, be aware that the registry path referenced will probably differ from yours. The names of the registry keys vary depending on  what ATI video card you are using. <em>VEN_1002&amp;DEV_9540&amp;SUBSYS_00021028&amp;REV_00\4&amp;10ef49db&amp;0&amp;0008</em> refers to the Radeon HD 4550 video card on the machine that I was using to troubleshoot. One way to solve this is by writing a VBScript that searches for ATI display adapters under <em>HKLM\System\CurrentControlSet\Enum\PCI </em>and verifies that <em>ConfigFlags</em> is set to 0&#215;0.</p>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2010/06/29/ati-radeon-causes-a-uac-prompt-at-user-logon/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Dell Warranty Information Script</title>
		<link>http://iboyd.net/index.php/2010/06/17/dell-warranty-information-script/</link>
		<comments>http://iboyd.net/index.php/2010/06/17/dell-warranty-information-script/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 21:00:58 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[warranty information]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=362</guid>
		<description><![CDATA[Important: Due to changes to Dell&#8217;s website, the script below no longer works. An updated script is available on this page. Updated: 2/14/2012 This is a VBScript that I wrote a few months ago as an example of how to retrieve warranty information from the Dell website. The script writes warranty information to subkeys under [...]]]></description>
				<content:encoded><![CDATA[<div style="margin: 5px 0 15px; background-color: #ffebe8; border-color: #CC0000; padding: 0 0.6em; border-radius: 3px 3px 3px 3px; border-style: solid; border-width: 1px;">
<p><strong>Important:</strong> Due to changes to Dell&#8217;s website, the script below no longer works. An updated script is available on <a title="Updated Dell Warranty Information Script" href="http://iboyd.net/index.php/2012/02/14/updated-dell-warranty-information-script/" target="_blank">this page</a>.</p>
<p>Updated: 2/14/2012</p>
</div>
<p>This is a VBScript that I wrote a few months ago as an example of how to retrieve warranty information from the Dell website. The script writes warranty information to subkeys under HKLM\Software\DellWarrantyInfo in the registry.</p>
<p>Dell doesn&#8217;t provide a web service for querying warranty information (that I know of), so I had to scrape the HTML.<span style="text-decoration: underline;"> That means this script may stop working properly if Dell makes changes to the layout of their warranty information page.</span> I wish Dell provided a more reliable method for retrieving warranty information.</p>
<p><strong>Update 1/3/2011: </strong>Thanks to <a href="http://blog.macadmincorner.com/" target="_blank">Patrick</a> for letting me know that dell added a new column to the warranty information table. I updated the script to reflect this.</p>
<p><span id="more-362"></span></p>
<pre class="brush: vb">'=====================================================================
'	Dell Warranty Grabber
'	Author: 	Matthew Boyd (iboyd.net)
'	Date:		3/25/2010
'
'	This is  an example of how to query the Dell website for
'	Warranty Information and parse the HTML source.
'	values are then written to the registry of the local
'	computer.
'
'	Usage:	cscript.exe DellWarrantyGrabber.vbs
'
'	Note: This must be run under an account with admin rights.
'	This script is provided AS IS with no support or warranties.
'	Use at your own risk!
'=====================================================================
Option Explicit

Dim url, regkey, svctag
Dim warrantyRows, warrantyCols
Dim objShell, objIE, objWMI
Dim i, result

url = "http://support.dell.com/support/topics/global.aspx/support/my_systems_info/details?c=us&amp;cs=RC956904&amp;l=en&amp;s=hied&amp;~lt=bodyonly&amp;~wsf=tabs&amp;servicetag="
regkey = "HKEY_LOCAL_MACHINE\Software\DellWarrantyInfo"
set objIE=createobject("internetexplorer.application")
set objShell = WScript.CreateObject("WScript.Shell")
set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

If InStr(UCase(objWMI.ExecQuery("Select Manufacturer From Win32_ComputerSystem").ItemIndex(0).Manufacturer), "DELL") = 0 then Err.Raise 2, "This is not a Dell dude!", "No Service Tag"

svctag = objWMI.ExecQuery  ("Select SerialNumber from Win32_BIOS").ItemIndex(0).SerialNumber

result = objShell.Run("reg.exe delete '" &amp; regkey &amp; "' /f", true)
If not result = 0 then Err.Raise result, "Unable to delete registry key!", "Code " &amp; result

result = objShell.Run("reg.exe create '" &amp; regkey &amp; "' /ve", true)
If not result = 0 then Err.Raise result, "Unable to delete registry key!", "Code " &amp; result

objIE.navigate url &amp; svctag
do while objIE.readystate&lt;&gt;4 : wscript.sleep 50 : loop

set warrantyRows = objIE.document.getElementsByTagName("table").item(1).getElementsByTagName("table").item(2).getElementsByTagName("table").item(0).getElementsByTagName("tr")

For i = 1 to warrantyRows.length - 1
set warrantyCols = warrantyRows.item(i).getElementsByTagName("td")

wscript.echo warrantyrows.item(i).innerText

objShell.regWrite regkey &amp; "\" &amp; i &amp; "\", ""
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Description", warrantyCols.item(0).innerText
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Provider", warrantyCols.item(1).innerText
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Warranty Extension Notice", warrantyCols.item(2).innerText
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Start Date", warrantyCols.item(3).innerText
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\End Date", warrantyCols.item(4).innerText
objShell.regWrite regkey &amp; "\" &amp; i &amp; "\Days Left", warrantyCols.item(5).innerText

Next</pre>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2010/06/17/dell-warranty-information-script/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Windows 7 Power Management: Fixing PC Insomnia</title>
		<link>http://iboyd.net/index.php/2010/05/16/windows-7-power-management-fixing-pc-insomnia/</link>
		<comments>http://iboyd.net/index.php/2010/05/16/windows-7-power-management-fixing-pc-insomnia/#comments</comments>
		<pubDate>Sun, 16 May 2010 07:25:23 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[Power Management]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[pc insomnia]]></category>
		<category><![CDATA[pc narcolepsy]]></category>
		<category><![CDATA[power management]]></category>
		<category><![CDATA[power options]]></category>
		<category><![CDATA[powercfg]]></category>
		<category><![CDATA[standby]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=300</guid>
		<description><![CDATA[As I&#8217;ve mentioned before, putting workstations into a low power standby mode when not in use is a great way to save money. Unfortunately, standby doesn&#8217;t always work like it should. Many sysadmins have struggled with applications, settings, and even system drivers that prevent standby from working reliably, or working at all. There were many [...]]]></description>
				<content:encoded><![CDATA[<p>As I&#8217;ve mentioned before, putting workstations into a low power standby mode when not in use is a great way to save money. Unfortunately, standby doesn&#8217;t always work like it should. Many sysadmins have struggled with applications, settings, and even system drivers that prevent standby from working reliably, or working at all.</p>
<p>There were many scenarios in past versions of Windows where workstations configured to  enter standby after a certain period of idle time would refuse to do so, often  without many clues as to why. This behavior is commonly (and cleverly) referred to as PC insomnia. While Windows 7 computers can still  suffer from insomnia, the latest Windows OS now includes new tools and settings to troubleshoot and resolve it.  There are a variety of things that may prevent a computer from properly entering standby when idle. Common reasons include hardware driver issues, service issues, and open file shares. Windows XP did not include any tools that could help pinpoint what was keeping the system awake, which often made finding the culprit a guessing game. Thankfully, the command line utility POWERCFG.EXE was updated in Windows 7 to include two new options that assist with tracking down insomnia issues.</p>
<p>If you haven&#8217;t already, you should check out my <a href="http://iboyd.net/index.php/2010/05/07/windows-7-power-management-applying-power-settings-with-powercfg/" target="_blank">previous article</a> about power management in Windows 7 in order to learn about power profiles and POWERCFG.EXE commands.</p>
<h3>POWERCFG -REQUESTS</h3>
<p>One way to troubleshoot Windows 7 insomnia issues, is the POWERCFG.EXE -REQUESTS command. This command can be used to display a list of applications and drivers that have made requests to prevent the computer from entering standby.</p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_302" class="wp-caption aligncenter" style="width: 648px;">
<dt class="wp-caption-dt"><a href="http://iboyd.net/wp-content/uploads/2010/05/powerconfig-requests.jpg" rel="lightbox[300]"><img class="size-full wp-image-302  " title="POWERCFG -REQUESTS" src="http://iboyd.net/wp-content/uploads/2010/05/powerconfig-requests.jpg" alt="Example output from the powercfg -requests command" width="638" height="326" /></a></dt>
</dl>
</div>
<p>In the example above, there are actually two Windows components that are preventing the system from entering standby. The first issue is that Windows wants to keep this particular computer awake because a remote host is connected to a share on the computer . If this computer was acting as a network file server, that would probably be a good thing. But it&#8217;s not, so we either need to prevent the computer from sharing files at all, or allow it to enter standby regardless of whether a remote host is connected to a file share. The other issue is that Windows wants to keep this computer awake because it&#8217;s connected to a remote file share. While there are probably cases where this behavior is desired, I want Windows to enter standby regardless of whether or not the computer is connected to a remote network share. Otherwise, most workstations would never enter standby! Both of these issues can normally resolved by changing a few hidden power options, which is covered later in this article.</p>
<h3>POWERCFG -ENERGY</h3>
<p>In a some cases, it may also be useful run POWERCFG.EXE -ENERGY. This command performs a more thorough investigation  in order find potential power management issues, such as those that may be preventing standby. When POWERCFG -ENERGY is run, it detects common issues by monitoring the system for a period of time and capturing system settings and events that may be preventing Windows power management from working properly. When done, the results are written to a HTML file.</p>
<p>By default, POWERCFG.EXE -ENERGY analyzes the system for 60 seconds. However,  the analysis duration can be be set to a larger period of time to detect more sporadic events that are preventing standby. To perform an analysis for 10 minutes, run POWERCFG -ENERGY -DURATION 600. When finished, the results are written to energy-report.html,  or the filename specified with -OUTPUT &lt;FILENAME&gt;.</p>
<p style="text-align: left;">
<div class="mceTemp mceIEcenter">
<dl id="attachment_301" class="wp-caption aligncenter" style="width: 512px;">
<dt class="wp-caption-dt"><a href="http://iboyd.net/wp-content/uploads/2010/05/energy-report.jpg" rel="lightbox[300]"><img class="size-large wp-image-301   " title="Windows 7 Energy Report" src="http://iboyd.net/wp-content/uploads/2010/05/energy-report-1024x856.jpg" alt="An example of the output generated by POWERCFG.EXE -ENERGY" width="502" height="419" /></a></dt>
</dl>
</div>
<p>While this report is more thorough that POWERCFG -REQUESTS, it may include items that aren&#8217;t necessarily related to issues with standby. For example, the report above shows the error <strong>USB Suspend:USB Device not Entering Suspend </strong>for several USB devices on this computer<strong>. </strong>While this may affect the computer&#8217;s power efficiency at some level,  it&#8217;s not the reason that this computer was entering standby. In this case, the standby was being blocked by the  <strong>System Required Request </strong>initiated by the driver <strong>\FileSystem\srvnet</strong>. This is related to the Windows network shares, and indicated to me that that standby was  being blocked because a remote host was trying to connect to a share on the client computer. I wasn&#8217;t able to see this when running POWERCFG -REQUESTS alone.</p>
<h3>Manually Checking Services</h3>
<p>If neither of the tools mentioned above help pinpointthe cause of insomnia, you may want to try manually verifying that Windows Services aren&#8217;t preventing standby. This troubleshooting method is simple, but a bit tedious:</p>
<ol>
<li>First, go to<strong> Start &gt; Control Panel &gt; Power Options</strong> and configure the current power profile so that the system enters standby after 1 minute.</li>
<li>Go to <strong>Start &gt; Control Panel &gt; Administrative Tools &gt; Services</strong>. Sort the services by the status column.</li>
<li>One by one, stop services that are running. Each time you stop a service, let the computer idle for at least 2 minutes to see if it enters standby. Continue doing this until the computer enters standby. It&#8217;s probably best to begin with non-Windows services.</li>
<li>If/when the computer finally enters standby after you&#8217;ve stopped a service, make note of that service. Restart the computer so that all services are running again. Stop that particular service again and wait for the computer to idle into standby.</li>
<li>If the computer idles to standby, you have found the service that is preventing system standby.</li>
</ol>
<p>What services could be causing insomnia? Some anti-virus applications have been known to prevent the system from entering standby for various reasons. Older or poorly-written services may also be the cause of PC insomnia.</p>
<h2>Treating Insomnia</h2>
<p>Windows 7 includes several power settings that may be useful for resolving PC insomnia. Interestingly, some of them are hidden and must be enabled in the system registry. Below are some common settings and methods for treating insomnia.</p>
<h3><strong>Allow Standby with Remote Opens<br />
</strong></h3>
<p>By default, Windows 7 will attempt to prevent system standby when connected to a  a remote share or file. Presumably, this is to prevent any ongoing file transfers over the network from failing due to the system unexpectedly entering standby. But there are many cases where the system is connected to a remote share and it is okay to enter standby. Windows 7 includes a setting to allow the computer to enter standby, but it may be missing from the advanced power options dialog box. This .reg file will unhide the &#8220;Allow sleep with remote opens&#8221; option AND set it to Yes for three default power profiles (Balanced, High Performance, and Power Saver) in Windows 7:</p>
<pre class="brush:plain">Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\d4c1d4c8-d5cc-43d3-b83e-fc51215cb04d]
"Attributes"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\d4c1d4c8-d5cc-43d3-b83e-fc51215cb04d\DefaultPowerSchemeValues\381b4222-f694-41f0-9685-ff5bb260df2e]
"ACSettingIndex"=dword:00000001
"DCSettingIndex"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\d4c1d4c8-d5cc-43d3-b83e-fc51215cb04d\DefaultPowerSchemeValues\8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c]
"ACSettingIndex"=dword:00000001
"DCSettingIndex"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\d4c1d4c8-d5cc-43d3-b83e-fc51215cb04d\DefaultPowerSchemeValues\a1841308-3541-4fab-bc81-f71556f20b4a]
"ACSettingIndex"=dword:00000001
"DCSettingIndex"=dword:00000001
</pre>
<p>Although the registry entries above will configure the three default power profiles, it won&#8217;t apply the settings to custom power profiles. To do that, you&#8217;ll need to find the Power Scheme GUID of the power profile you created by using POWERCFG.EXE /LIST and then run these commands:</p>
<pre class="brush:plain">POWERCFG.EXE /SETACVALUEINDEX &lt;POWER SCHEME GUID&gt; 238c9fa8-0aad-41ed-83f4-97be242c8f20 d4c1d4c8-d5cc-43d3-b83e-fc51215cb04d 1
POWERCFG.EXE /SETDCVALUEINDEX &lt;POWER SCHEME GUID&gt; 238c9fa8-0aad-41ed-83f4-97be242c8f20 d4c1d4c8-d5cc-43d3-b83e-fc51215cb04d 1</pre>
<h3><strong>Allow Standby when Sharing Media<br />
</strong></h3>
<p>If the system is configured with file or media sharing enabled, Windows 7 may prevent the system from entering standby while users are connected to files or shares hosted on the system in order to prevent file transfers from being interrupted. Sometimes, media, file, and printer sharing may be enabled on the  workstation without the user or the sysadmin knowing it. To make matters  worse, there are some network applications installed that tend to scan  network shares at regular intervals, which may prevent standby.</p>
<p>This behavior can be disabled by setting  &#8220;When sharing media&#8221; to &#8220;Allow Computer to Sleep&#8221; within the advanced settings of a power profile. The setting shouldn&#8217;t be hidden by default. To apply this setting to a custom Windows 7 power profile, these commands can be used:</p>
<pre class="brush:plain">POWERCFG.EXE /SETACVALUEINDEX &lt;POWER SCHEME GUID&gt; 9596fb26-9850-41fd-ac3e-f7c3c00afd4b 03680956-93bc-4294-bba6-4e0f09bb717f 0
POWERCFG.EXE /SETDCVALUEINDEX &lt;POWER SCHEME GUID&gt; 9596fb26-9850-41fd-ac3e-f7c3c00afd4b 03680956-93bc-4294-bba6-4e0f09bb717f 0</pre>
<h3><strong>Add Power Request Override</strong></h3>
<p>While <a title="SetExecutionThreadState can be used to tell the system to stay out of standby." href="http://msdn.microsoft.com/en-us/library/Aa373208" target="_blank">applications can request that Windows to keep the system awake</a>, that doesn&#8217;t mean that the OS should always listen. Applications make power requests like this for several reasons. For example, Windows Update may make a  request keep to computer awake while updates are being installed or a  reboot is pending. It&#8217;s actually very easy to implement a power request that blocks standby, which means it could be abused by a service or process that <em>thinks</em> it knows what&#8217;s good for it. If the results from POWERCFG -REQUESTS or POWERCONFIG -ENERGY show that a particular service or process is making a lot of unnecessary power requests, there is a way in Windows 7 to ignore those requests. To learn more about overriding a power requests, browse to the &#8220;Overriding a Power Request&#8221; section of this <a href="http://www.microsoft.com/whdc/system/pnppwr/powermgmt/AvailabilityRequests.mspx" target="_blank">Microsoft paper</a>.</p>
<h3>Don&#8217;t Allow System Required Policy</h3>
<p>If you&#8217;ve tried everything but still can&#8217;t get that  insomniac system to enter standby when idle, there is one last setting that you can use in a last ditch attempt.</p>
<p>However,the &#8220;Allow System Required Policy&#8221; power setting may also cause Windows to ignore valid requests to keep the computer awake. Therefore, this setting should only be used if nothing else works and you&#8217;ve tried using a Power Request Override to ignore specific drivers, processes, and services. This registry entry will unhide the setting:</p>
<pre class="brush:plain">Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\A4B195F5-8225-47D8-8012-9D41369786E2]
"Attributes"=dword:00000000
</pre>
<p>To disable power request overrides for a power profile, these commands can be used:</p>
<pre class="brush:plain">POWERCFG.EXE /SETACVALUEINDEX &lt;POWER SCHEME GUID&gt; 238C9FA8-0AAD-41ED-83F4-97BE242C8F20 A4B195F5-8225-47D8-8012-9D41369786E2 0
POWERCFG.EXE /SETDCVALUEINDEX &lt;POWER SCHEME GUID&gt; 238C9FA8-0AAD-41ED-83F4-97BE242C8F20 A4B195F5-8225-47D8-8012-9D41369786E2 0</pre>
<h2>What about Narcolepsy?</h2>
<p>Another common issue with Windows systems that enter standby is <em>PC Narcolepsy.  PC Narcolepsy</em> refers to a behavior of the Windows Operating System, where a computer that resumes standby from a Wake-on-LAN (WOL) or scheduled wakeup event will enter standby again after 2 minutes unless there is user interaction, such as pressing a key on the mouse or keyboard. In Windows XP, there wasn&#8217;t any way to change this behavior. Fortunately, Windows 7 introduces a new power option that can change the amount of time that the computer resumes from standby:  <em>System unattended sleep timeout</em>. However this setting is hidden in the power profile by default. Why is it hidden? I&#8217;m not quite sure. Perhaps because it could be confused with the standby timeout setting. It can be unhidden using this reg file:</p>
<pre class="brush:plain">Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0]
"Attributes"=dword:00000000
</pre>
<p>Once unhidden, this setting will be visible in the advanced power options dialog. However, most sysadmins need a way to automate the configuration of this setting. Like several of the settings above, this can be done if you know the GUID of the power profile that you want to set this setting on:</p>
<pre class="brush:plain">POWERCFG.EXE /SETACVALUEINDEX &lt;POWER SCHEME GUID&gt; 238c9fa8-0aad-41ed-83f4-97be242c8f20 7bc4a2f9-d8fc-4469-b07b-33eb785aaca0 &lt;DURATION IN SECONDS&gt;
POWERCFG.EXE /SETDCVALUEINDEX &lt;POWER SCHEME GUID&gt; 238c9fa8-0aad-41ed-83f4-97be242c8f20 7bc4a2f9-d8fc-4469-b07b-33eb785aaca0 &lt;DURATION IN SECONDS&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2010/05/16/windows-7-power-management-fixing-pc-insomnia/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Windows 7 Power Management: Applying Power Settings with POWERCFG</title>
		<link>http://iboyd.net/index.php/2010/05/07/windows-7-power-management-applying-power-settings-with-powercfg/</link>
		<comments>http://iboyd.net/index.php/2010/05/07/windows-7-power-management-applying-power-settings-with-powercfg/#comments</comments>
		<pubDate>Fri, 07 May 2010 14:14:58 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[Power Management]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[power management]]></category>
		<category><![CDATA[powercfg]]></category>
		<category><![CDATA[standby]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=327</guid>
		<description><![CDATA[Between Windows XP and Windows 7, Microsoft made significant changes under the hood to power management in order to make Windows a more energy efficient OS. While Windows Vista included a significant number of changes to power management, it really seems like Microsoft put much more effort into making Windows 7 more power efficient after [...]]]></description>
				<content:encoded><![CDATA[<p>Between Windows XP and Windows 7, Microsoft made significant changes  under the hood to power management in order to make Windows a more  energy efficient OS. While Windows Vista included a significant number  of changes to power management, it really seems like Microsoft put much  more effort into making Windows 7 more power efficient after complaints  about terrible battery life with Windows Vista. <a title="Windows 7  Power Management" href="http://download.microsoft.com/download/8/5/4/854f66b6-8c09-4f8a-986e-38e9ebac1677/windows7_power_management_whitepaper.pdf" target="_blank">This PDF</a> provides a general overview of these  changes. Many of the changes work out of the box, which is great for overworked sysadmins. However, there are a few settings that need to  be configured as needed, particularly when it comes to system idle and  standby settings. With Windows 7, Microsoft has included several  additional features and troubleshooting tools that address some of the  headaches caused by power management in Windows XP.</p>
<h2>Standby Me</h2>
<p>Before we dive into the guts of power management in Windows 7, let&#8217;s  discuss the value of taking the time to configure power management  settings.  Since <em>going green </em>is a hot trend right now, many  companies are starting to put pressure on sysadmins to find ways to  squeeze power savings from a major offender to the energy grid: Computers. At many companies, workstations are left running 24&#215;7,  even when not in use. If the work week is only 40 hours, that means that  many of these computers are in a Powered On with Nothing to Do (POND)  state for 100+ hours per week.  <a title="Ford saves 1.2 million by  turning computers off" href="http://www.treehugger.com/files/2010/03/ford-saves-more-than-1-million-dollars-by-turning-computers-off.php" target="_blank">As Ford recently discovered</a>, turning computers off  when they are not in use is a great way to reduce energy waste and save  some serious coin!</p>
<p>One disadvantage to turning off computers completely when not in use  is that, when a user needs to use the computer again, they have to wait  for the  computer to start up, then log in, then load applications and  documents  again. Admittedly, this a bit time consuming and frustrating  for an end user.  Therefore, many sysadmins opt to put computers into a  low power standby mode as a fair compromise between user experience and  energy savings. Standby mode, which powers down most system components  as suspends the system state to RAM, allows the user <em>instantly resume </em>where they left off when they last used the computer. In modern  computers, standby only consumes slightly more power than when in a  powered off state.</p>
<h2>Applying Settings with POWERCFG<strong><strong><br />
</strong></strong></h2>
<p>If you&#8217;ve used the POWERCFG utility in Windows XP, you&#8217;ll probably  find one major difference in Windows 7: GUIDs. In Windows XP, a power  scheme could be configured by specifying the name of the scheme in the  POWERCFG command line syntax. In Windows 7, that is no longer an option.  Instead, you must specify the GUID associated with a particular power  scheme when configuring and activating a scheme. While POWERCFG in  Windows 7 still includes a way to change the monitor, disk, and standby  timeouts of the <em>active </em>scheme, it takes some understanding of the  Windows 7 power management GUIDs to do anything beyond that. Not only  are the power schemes themselves identified by GUIDs, Windows 7 uses  GUIDs to uniquely identify settings and groups of settings as well. While the idea of working with GUIDs may seem like a daunting task, it&#8217;s actually pretty easy to wrap your head around once you  know how to find and use these GUIDs.</p>
<p>The most straightforward  way to get a list of power scheme, group, and setting GUIDs is to run <strong>POWERCFG  -QUERY</strong>. As a side note, this command tends to generate a lot of  output, so it may be wise to pipe the output to a file like this:</p>
<pre>POWERCFG.EXE -QUERY &gt; powercfg.txt
</pre>
<p>After  running the command, the current directory should contain the  powercfg.txt file with the output from POWERCFG &#8211; QUERY inside of it.  Here&#8217;s what it looks like:</p>
<p style="text-align: center;"><a href="http://iboyd.net/wp-content/uploads/2010/05/powercfg-query.jpg" rel="lightbox[327]"><img class="aligncenter size-full wp-image-322" title="POWERCFG -QUERY" src="http://iboyd.net/wp-content/uploads/2010/05/powercfg-query.jpg" alt="An example of the output from the POWERCFG -QUERY command" width="656" height="455" /></a></p>
<p>As you can see from the example  above, POWERCFG -QUERY provides very detailed information about every  power scheme and setting set in power options in a nicely indented  format. At the top is the GUID associated with the power scheme (High  Performance). Directly below that is the GUID that identifies the first  subgroup of settings (settings belonging to no subgroup). The GUIDs that  identify each setting are directly below that, with information about  possible setting values.</p>
<h3>Example</h3>
<p>Let&#8217;s say we  wanted to change the setting <strong>Require a Password on Wakeup</strong> to <strong>No</strong> within  the <strong>High Performance</strong> power scheme. First, we need to use the output  from POWERCFG -QUERY to find the associated GUIDs and setting index:</p>
<p><a href="http://iboyd.net/wp-content/uploads/2010/05/powercfg-query-highlight.jpg" rel="lightbox[327]"><img title="powercfg-query-highlight" src="http://iboyd.net/wp-content/uploads/2010/05/powercfg-query-highlight.jpg" alt="The output of POWERCFG -QUERY that highlights the GUIDs used in  this example." width="607" height="144" /></a></p>
<p>These values are  then plugged into commands <strong>POWERCFG -SETACVALUEINDEX</strong> and <strong>POWERCFG  -SETDCVALUEINDEX</strong>:</p>
<pre class="brush:plain">POWERCFG -SETACVALUEINDEX 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 0
POWERCFG -SETDCVALUEINDEX 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 0</pre>
<p>As you may have  guessed, the first command affects the computer while it&#8217;s plugged in.  The second affects the computer while on battery. There&#8217;s a few things  that have been implied in this example, but are worth covering in case  you plan to script power settings for a fleet of computers:</p>
<ul>
<li>Windows  includes three built-in power schemes: Balanced, High Performance, and  Power Saver. These schemes are identified by the same GUID on every  Windows 7 computer.</li>
<li>The GUIDs that identify subgroups and  power settings are the same on every Windows 7 computer.</li>
<li>To  create a new scheme, use this command:
<pre class="brush:plain">POWERCFG -DUPLICATESCHEME &lt;POWER SCHEME GUID&gt; &lt;NEW GUID&gt;
</pre>
<p>The  &lt;NEW GUID&gt; parameter is optional. If it is not specified, POWERCFG will  automatically generate a new GUID.</li>
<li>Remember that if  &lt;NEW GUID&gt; is omitted, the GUID that identifies your new scheme will be  different on each computer that you run this command on.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2010/05/07/windows-7-power-management-applying-power-settings-with-powercfg/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SharePoint Foundation 2010 and Office Web Applications</title>
		<link>http://iboyd.net/index.php/2010/03/08/sharepoint-foundation-2010-and-office-web-applications/</link>
		<comments>http://iboyd.net/index.php/2010/03/08/sharepoint-foundation-2010-and-office-web-applications/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 22:38:26 +0000</pubDate>
		<dc:creator>Boyd</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[Office Web Applications]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://iboyd.net/?p=284</guid>
		<description><![CDATA[Several posts ago, I promised to provide some insight on the new development capabilities for SharePoint 2010 within Visual Studio 2010. Yeah, I&#8217;m still working on that. However, I did get around to installing and test driving Office Web Applications on top of SharePoint foundation and I have to say that I am quite impressed [...]]]></description>
				<content:encoded><![CDATA[<p>Several posts ago, I promised to provide some insight on the new development capabilities for SharePoint 2010 within Visual Studio 2010. Yeah, I&#8217;m still working on that. However, I did get around to installing and test driving Office Web Applications on top of SharePoint foundation and I have to say that I am quite impressed so far.</p>
<p>In recent years, it has become evident that Microsoft needs to port their office suite to the Word Wide Web in order to compete with Google Apps. For Office 2010, Microsoft has stepped up to the challenge by releasing a free online Office suite, appropriately named Office Web Applications. Despite being a bit rough around the edges, the applications provide an excellent idea of what direction Microsoft is headed in, and it certainly looks good.</p>
<div id="attachment_286" class="wp-caption alignleft" style="width: 310px"><a href="http://iboyd.net/wp-content/uploads/2010/03/SharePoint-WordViewer.jpg" rel="lightbox[284]"><img class="size-medium wp-image-286" title="SharePoint - Word Viewer" src="http://iboyd.net/wp-content/uploads/2010/03/SharePoint-WordViewer-300x227.jpg" alt="" width="300" height="227" /></a><p class="wp-caption-text">The Word Viewer Web App provides a read-only version of the Word document inside of the browser.</p></div>
<p>In my opinion, there&#8217;s one huge advantage that Microsoft has over some (but not all) of the other competitors in the Online Office Suite market: Organizations have the option to host the Office Web Applications themselves. For organizations that can&#8217;t or don&#8217;t want to use a hosted solution, this could be huge. To get there, Microsoft has married the document management capabilities of Microsoft SharePoint with the new functionality that the Office Web Applications offer. As a system administrator, you must play the role of the priest in this wedding: Getting the Office Web Apps functionality requires a separate installation from SharePoint. The good news is that installing Office Web Apps feels relatively painless. As for the benefits? Well, imagine opening a Word document in SharePoint without ever opening Microsoft Word. Now imagine editing that document and saving it back to SharePoint without ever opening Word or even leaving your web browser. Daddy like.</p>
<p>From both an interface and functionality perspective, SharePoint and Office Web Apps integrate fairly well. By default, the Microsoft Word Web App opens documents in a read-only view. With this view, documents are displayed almost identically to how they look within the installed version Microsoft Word. Most text can be selected and copied to the clipboard. It&#8217;s like viewing a PDF document in a browser, but without the terrible Adobe Reader browser plug-in.</p>
<p>So how does the Word Web App do at actually editing documents? Well, it provides a lot of great functionality, but it does leave something to be desired.  A familiar ribbon is displayed at the top of the page, with basic tools for formatting text, inserting pictures, and creating tables. Just don&#8217;t expect all of the special features that you&#8217;re used to seeing in the installed version of Word. It is free, after all. A few of the documents I tested did not have certain formatting settings that were visible in the online editor, such as table backgrounds. I&#8217;m not surprised by that. Overall, I see this as a great way to generate quick documentation or take notes, but I wouldn&#8217;t recommend it for advanced publishing. In fact, I wouldn&#8217;t recommend any of the online document editors for advanced publishing. They just aren&#8217;t that robust.</p>
<div id="attachment_288" class="wp-caption alignright" style="width: 310px"><a href="http://iboyd.net/wp-content/uploads/2010/03/SharePoint-WordEditor.jpg" rel="lightbox[284]"><img class="size-medium wp-image-288" title="SharePoint - Word Editor" src="http://iboyd.net/wp-content/uploads/2010/03/SharePoint-WordEditor-300x227.jpg" alt="" width="300" height="227" /></a><p class="wp-caption-text">The Word Web App provides a lot of basic document editing functionality. Just don&#39;t expect to do a mail merge through it.</p></div>
<p>One of the most significant features (if you want to call it that) of the Office Web Apps is that they work across browsers, just like SharePoint 2010. This has always been a huge pain point for me with SharePoint 2007 and a few other Microsoft web products, because they have traditionally catered to Internet Explorer, and I am a Firefox user. There is also better support for viewing SharePoint sites and Word documents from mobile devices. I&#8217;m glad that culture at Microsoft has shifted such that they realize that cross-browser (and cross-platform) support will be crucial to their success in the future and I hope they continue down that path.</p>
<p>I haven&#8217;t had a chance to try out the Excel Web App, or the PowerPoint Viewer. I&#8217;ll save those for another weekend. Some good news for those waiting for the production version of SharePoint and Office 2010: Microsoft just announced that these products will  <a title="Sharepoint 2010 and Office 2010 Launch" href="http://blogs.msdn.com/sharepoint/archive/2010/03/05/sharepoint-2010-office-2010-launch.aspx" target="_blank">launch on May 12, 2010 and RTM sometime in April</a>. It will be interesting to see if there are any new features between the Betas and the RTMs. Regardless, I&#8217;m really looking forward to the latest iteration of these products.</p>
<p>If you&#8217;re looking for more information about Office Web Applications, be sure to check out the Office Web Apps blog on MSDN: <a title="MSDN Office Web Apps Blog" href="http://blogs.msdn.com/officewebapps/" target="_blank">http://blogs.msdn.com/officewebapps/</a> .</p>
]]></content:encoded>
			<wfw:commentRss>http://iboyd.net/index.php/2010/03/08/sharepoint-foundation-2010-and-office-web-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
