Oct 192012
 

If you try putting an MSDN key into Anytime Upgrade, it will get started on the upgrade process then eventually fail telling you the key you entered cannot be used for Anytime Upgrade. The trick is to use some other key for the same version. This key, though, does not have to activate. I wanted to upgrade from Home to Professional. Luckily I had my Dell Laptop came with Windows 7 Professional.

  1. Run Anytime Upgrade with any key for the version you want to upgrade to (OEM keys work)
  2. After the computer restarts and updates, run slmgr.vbs /cpky to delete the product key
    slmgr.vbs is available on the internet, on Professional machines, and is probably located somewhere on the install medium
  3. Run slmgr.vbs /ipk XXXX-PRODUCT-KEY-HERE-XXXX
  4. Now slmgr.vbs /ato to activate it

** Each command may take a few minutes to finish even though it looks like it goes through instantly. A dialogue box will open with the results when the command has actually completed.

I highly recommend making a disk image before trying this process in case something breaks in the process. You can use Clonezilla, Acronis, Norton Ghost, among many other programs. There are plenty of guides online

Aug 102012
 

Early today I was looking for a way to automatically run Disk Cleanup on multiple computers in a domain. I found the /sageset switch which allows you to define the options you want to use in conjunction with /sagerun, but none of the articles mentioned anything about saving the settings for use on multiple computers. Using Regshot 2.0 unicode on Windows XP I determined the settings are saved in:

HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches

There is a key for each category and a StateFlags dword value for each configuration made using /sageset. The StateFlags value has a number after it that corresponds to the /sageset number. By exporting a the VolumeCaches key and merging in before running cleanmgr /sagerun, you can easily deploy a Disk Cleanup policy. I won’t have time to thoroughly test this on different machines until Monday, so USE WITH CAUTION.

Jun 132012
 

I’m not completely sure why this error is generated, but I have a hunch it’s because CutePDF tries to use a list of already installed PostScript print drivers and if none of the pre-configured ones are found, it errors out and will not continue.

  1. Install CutePDF Writer and allow it to error out. Make sure you select to install the PS2PDF tool when it asks.
  2. Go to Devices and Printers and select Add a Printer
  3. Add a Local Printer
  4. Make sure the drop down has an option for CPW2: (CutePDF Writer) otherwise these steps will not work
  5. I went ahead and selected LPT1: (Printer Port)
  6. For driver you’ll need to find a PostScript compatible driver. I went to the HP drivers and selected the HP Color LaserJet 2500 PS driver. The PS at the end represents that it is a PostScript driver. You may have to look in the list, but there should be plenty of PostScript compatible HP drivers you can pick from.
  7. Continue on with the install and finally add the printer
  8. Go back to Devices and Printers and right click on the printer you just selected and choose Printer Properties
  9. You can change the name in the first text box to CutePDF or similar so it’s easier to find and remember
  10. On the Ports tab, change the port to CPW2: (CutePDF Writer).
  11. Apply/Ok after changing the port
  12. Do a test print. If you choose CutePDF (or whatever you named it) you should be prompted with a dialogue box asking where you’d like to save the PDF.
Jun 102012
 

Background

Google Chrome prevents Java from automatically running when it detects that the version you currently have installed is not the most recent. I finally got tired of the nagging and decided to upgrade to 7u4 (from 6u29). I downloaded the offline version and proceeded to install it, but it kept failing with some sort of error and directing me to a help page on the Java website. I head on over to Programs and Features and attempted to uninstall all old versions, but the x86 version refused to uninstall (both x86 and x64 Java are installed). I then attempted to manually remove Java using DK Finder and regscanner (by NirSoft). I deleted every trace of Java I could possibly find. I even installed Java in a virtual machine and monitored the installation with Regshot 2.0 unicode to make sure I had all the correct registry keys deleted, but even that did not help.

Process

  1. Visit http://support.microsoft.com/kb/223300 and download/run the fixit tool that enables Windows Installer Logging
  2. Attempt to install Java again
  3. After it fails, put %temp% in the run box to bring you to the Temporary Files folder
  4. Switch to details view and sort by Date Modified/Descending (this will put the most recent files at the top)
  5. There should be a jusched.log and a MSI(random text).log
  6. Open the MSI log file and search for “return value 3″
  7. Find the last  ”return value 3″ entry
    In my case the line reads
    Action ended 22:38:28: SetupCompleteError. Return value 2.
    Action ended 22:38:28: INSTALL. Return value 3.
  8. This basically just indicates that setup encountered an error and the install won’t finish
  9. The error before it reads:
    Action ended 22:38:20: RemoveExistingProducts. Return value 3.
    Action ended 22:38:20: INSTALL. Return value 3.
  10. This is the helpful one. We can see that the installer is stopping when it’s trying to execute the RemoveExisitingProducts sequence
  11. To fix this, I downloaded SuperOrca and opened the MSI installer file located at %APPDATA%\\..\\LocalLow\\Java\\jre(version)\\jre(version).msi
  12. The above file should be extracted and left by the installer downloaded from the Java site after it’s been used at least once
  13. With the file open, I selected InstallExecuteSequence in the left pane and located RemoveExistingProducts
  14. I deleted the entry using the Drop Row command from the right-click menu
  15. I then saved it with a new name and executed it

Resources

Conclusion

I’m still not exactly sure how the problem got started in the first place, but it seems Java attempted to add a feature to remove previous versions that ended up breaking the installation for some reason. If you’re having problems with Java installation first try Programs and Features (Add/Remove Programs). Next, give JavaRa a try. If all else fails, you can give the above method a shot and hopefully get Java up and running without a reformat.

May 072012
 

Here’s a basic script I made that uses PHP, cURL, and barcoding.com. It reads UPCs from csv files (or just a list) and sends a request to barcoding.com. Barcoding.com then returns an image with the barcode. Keep in mind barcoding.com is a free service and isn’t designed to be used in the way this script uses it, so please use it carefully.


<?php
$file = 'upcs.csv'; // Path to CSV file
$field = 0; //Column number of the UPC (0 if in the first column, 1 for the 2nd column, etc)
$output = 'C:\\upcs\\'; //Directory to save outputted UPCs to

$csvFile = fopen($file, "r"); //open the csv file for reading
while($data = fgetcsv($csvFile)) { //for each, add upc to array
if(strlen($data[$field]) === 12) { //prevent from adding data that isn't a 12 digit upc
$upcA[] = $data[$field];
}
}
fclose($csvFile);

function saveBarcode($url, $code) {
global $output;
$url = "http://www.barcoding.com".$url;
$ofile = "$output$code.png";
if(@$out = fopen($ofile, "x")) { // prevent problems when the file already exists
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_FILE, $out);
curl_exec($ch);
curl_close($ch);
fclose($out);
}
}

function makeBarcode($code) { //generates barcode image from upc using barcoding.com
$url = "http://www.barcoding.com/upc/buildbarcode.asp?cpaint_function=BuildBarcode&cpaint_argument[]=$code&cpaint_argument[]=9&cpaint_argument[]=5&cpaint_response_type=TEXT";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$url = curl_exec($ch);
curl_close($ch);
saveBarcode($url, $code);
}

foreach($upcA as $upc) {
makeBarcode($upc);
}
?>