Title: Coping with Windows XP activiation on a Mac
Date: December 17, 2006
Timestamp: 1166427000
Author: sjs
Tags: parallels, windows, apple, mac os x, bootcamp
----


  <a href="http://web.archive.org/web/20070301102946/http://sami.samhuri.net/admin/content/edit/1003" class="admintools" id="admin_article" style="display: none;">edit</a>
  <h2>Coping with Windows XP activiation on a Mac</h2>
  <p class="auth"><!-- Posted by <a href="mailto:sjs@uvic.ca">Sami Jensen Samhuri</a> -->
  <span class="typo_date" title="Mon, 18 Dec 2006 07:30:00 GMT">Mon, 18 Dec 2006 07:30:00 GMT</span></p>
  <p><strong>Update:</strong> This needs to be run at system startup, before you log in. I have XP Home and haven’t been able to get it to run that way yet.</p>


	<p>I can’t test my method until I get XP Pro, if I get XP Pro at all. However chack left a <a href="http://web.archive.org/web/20070301102946/http://sami.samhuri.net/articles/2006/12/17/coping-with-windows-xp-activiation-on-a-mac#comments">comment</a> saying that he got it to work on XP Pro, so it seems we’ve got a solution here.</p>


<hr>


	<h3>What is this about?</h3>


	<p>I recently deleted my <a href="http://web.archive.org/web/20070301102946/http://www.microsoft.com/windowsxp/default.mspx">Windows XP</a> disk image for <a href="http://web.archive.org/web/20070301102946/http://www.parallels.com/en/products/workstation/mac/">Parallels Desktop</a> and created a <a href="http://web.archive.org/web/20070301102946/http://www.apple.com/macosx/bootcamp/">Boot Camp</a> partition for a new Windows XP installation. I created a new VM in Parallels and it used my Boot Camp partition without a problem. The only problem is that Windows XP Home wants to re-activate every time you change from Parallels to Boot Camp or vice versa. It’s very annoying, so what can we do about it?</p>


	<p>I was reading the Parallels forums and found out that you can <a href="http://web.archive.org/web/20070301102946/http://forums.parallels.com/post30939-4.html">backup your activation</a> and <a href="http://web.archive.org/web/20070301102946/http://forums.parallels.com/post32573-13.html">restore it later</a>. After reading that I developed a <a href="http://web.archive.org/web/20070301102946/http://forums.parallels.com/post33487-22.html">solution</a> for automatically swapping your activation on each boot so you don’t have to worry about it.</p>


	<p>I try and stick to Linux and <span class="caps">OS X</span> especially for any shell work, and on Windows I would use zsh on cygwin if I use any shell at all, but I think I have managed to hack together a crude batch file to solve this activation nuisance. It’s a hack but it sure as hell beats re-activating twice or more every day. It also reinforced my love of zsh and utter dislike of the Windows “shell”.</p>


	<p>If anyone actually knows how to write batch files I’d like to hear any suggestions you might have.</p><hr>


	<h3>Make sure things will work</h3>


	<p>You will probably just want to test my method of testing for Parallels and Boot Camp first. The easiest way is to just open a command window and run this command:</p>


<pre><code>ipconfig /all | find "Parallels"</code></pre>

	<p>If you see a line of output like <strong>“Description . . . . : Parallels Network Adapter”</strong> and you are in Parallels then the test works. If you see no output and you are in Boot Camp then the test works.</p>


	<p><em>If you see no output in Parallels or something is printed and you’re in Boot Camp, then please double check that you copied the command line correctly, and that you really are running Windows where you think you are.</em> ;-)</p>


	<p>If you’re lazy then you can download <a href="http://web.archive.org/web/20070301102946/http://sami.samhuri.net/files/parallels/test.bat">this test script</a> and run it in a command window. Run it in both Parallels and Boot Camp to make sure it gets them both right. The output will either be “Boot Camp” or “Parallels”, and a line above that which you can just ignore.</p>


<hr>


	<p><strong><span class="caps">NOTE</span>:</strong> If you’re running Windows in Boot Camp right now then do Step #2 before Step #1.</p>


<hr>


	<h2>Step #1</h2>


	<p>Run Windows in Parallels, activate it, then open a command window and run:</p>


<pre><code>
mkdir C:\Windows\System32\Parallels
copy C:\Windows\System32\wpa.* C:\Windows\System32\Parallels
</code></pre>
Download <a href="http://web.archive.org/web/20070301102946/http://sami.samhuri.net/files/parallels/backup-parallels-wpa.bat">backup-parallels-wpa.bat</a>

<hr>


	<h2>Step #2</h2>


	<p>Run Windows using Boot Camp, activate it, then run:</p>


<pre><code>
mkdir C:\Windows\System32\BootCamp
copy C:\Windows\System32\wpa.* C:\Windows\System32\BootCamp
</code></pre>
Download <a href="http://web.archive.org/web/20070301102946/http://sami.samhuri.net/files/parallels/backup-bootcamp-wpa.bat">backup-bootcamp-wpa.bat</a>

<hr>


	<h2>Step #3: Running the script at startup</h2>


	<p>Now that you have your activations backed up you need to have the correct ones copied into place every time your system boots. Save this file anywhere you want.</p>


	<p>If you have XP Pro then you can get it to run using the Group Policy editor. Save the activate.bat script provided here anywhere and then have it run as a system service. Go Start -&gt; Run… -&gt; gpedit.msc [enter] Computer Configuration -&gt; Windows Settings -&gt; Scripts (Startup/Shutdown) -&gt; Startup -&gt; Add.</p>


	<p>If you have XP Home then the best you can do is run this script from your Startup folder (Start -&gt; All Programs -&gt; Startup), but that is not really going to work because eventually Windows will not even let you log in until you activate it. What a P.O.S.</p>


<pre><code>
@echo off

ipconfig /all | find "Parallels" &gt; network.tmp
for /F "tokens=14" %%x in (network.tmp) do set parallels=%x
del network.tmp

if defined parallels (
  echo Parallels
  copy C:\Windows\System32\Parallels\wpa.* C:\Windows\System32
) else (
  echo Boot Camp
  copy C:\Windows\System32\BootCamp\wpa.* C:\Windows\System32
)
</code>
</pre>
Download <a href="http://web.archive.org/web/20070301102946/http://sami.samhuri.net/files/parallels/activate.bat">activate.bat</a>

<hr>


	<h3>You’re done!</h3>


	<p>That’s all you have to do. You should now be able to run Windows in Boot Camp and Parallels as much as you want without re-activating the stupid thing again!</p>


	<p>If MS doesn’t get their act together with this activation bullshit then maybe the Parallels folks might have to include something hack-ish like this by default.</p>


	<p>This method worked for me and hopefully it will work for you as well. I’m interested to know if it does or doesn’t so please leave a comment or e-mail me.</p>


<hr>


	<h4>Off-topic rant</h4>


	<p>I finally bought Windows XP this week and I’m starting to regret it because of all the hoops they make you jump through to use it. I only use it to fix sites in IE because it can’t render a web page properl and I didn’t want to buy it just for that. I thought that it would be good to finally get a legit copy since I was using a pirated version and was sick of working around validation bullshit for updates. Now I have to work around MS’s activation bullshit and it’s just as bad! Screw Microsoft for putting their customers through this sort of thing. Things like this and the annoying balloons near the system tray just fuel my contempt for Windows and reinforce my love of Linux and Mac <span class="caps">OS X</span>.</p>


	<p>I don’t make money off any of my sites, which is why I didn’t want to have to buy stupid Windows. I hate MS so much for making shitty IE the standard browser.</p>

