Roshan Book

My Tech Notebook

Category Archives: Windows

Remove Windows Activation Key & Licence

To remove windows activation key and Licence follow these steps:

 

  1. Open a command prompt as an Administrator.
  2. Enter slmgr /upk and wait for this to complete. This will uninstall the current product key from Windows and put it into an unlicensed state.
  3. Enter slmgr /cpky and wait for this to complete. This will remove the product key from the registry if it’s still there.
  4. Enter slmgr /rearm and wait for this to complete. This is to reset the Windows activation timers so the new users will be prompted to activate Windows when they put in the key.

Packaging Titanium desktop applications on Windows

Source:http://www.dionysopoulos.me/blog/packaging-titanium-dekstop-apps-on-windows

Maybe you have already tried Appcelerator’s Titanium. If not, you should have. It’s a very easy to use RAD framework for creating cross-platform desktop and mobile applications based on HTML, Javascript, PHP, Python and Ruby. However, I was having a grave issue lately with their desktop builds. No matter what, I could not build the Windows installation package of my applications. Appcelerator’s documentation on manually packaging applications is sketchy and outdated. So I did what any self-respecting hacker (in the good sense, i.e. geeky developer with a strong aspiration to solving complex problems) would. I figured out a solution myself and documented everything in the process.

First things first, we have to install some prerequisites to “prime” our environment for building installation packages of our Titanium applications. Sadly, Appcelerator’s documentation doesn’t mention much and is, of course, terribly outdated. To save you from trouble, I figured it all myself and present it to you right here.
SDK installation and setup

Before you begin, install Titanium Developer, launch it and install the desktop SDK. Do note that the first time you run it, it will prompt you to install the Mobile SDK. Do it. Then shut down the application, launch it again and it will prompt you to install the desktop SDK. Do it and shut down the application. Counter-intuitive it is, but it works…

You will also need to put Titanium’s SDK directory in the path. Once more, the documentation is just plain wrong and gives you an inexistent path. Anyway, Titanium SDK is ultimately installed in c:\ProgramData\Titanium\sdk\win32\VERSION, where VERSION is the Desktop API version. At the time of this writing the latest API was 1.1.0, so the path we need is c:\ProgramData\Titanium\sdk\win32\1.1.0.

In order to add that to the path, hit the Windows key + pause, click on Advanced system settings from the left bar, click on the Environment variables button, double click on path, append “;c:\ProgramData\Titanium\sdk\win32\1.1.0” without the quotes of course.

Finally, we need to put the directory of Titanium’s copy of ImageMagick to our path. In order to add that to the path, hit the Windows key + pause, click on Advanced system settings from the left bar, click on the Environment variables button, double click on path, append “;c:\ProgramData\Titanium\sdk\win32\1.1.0\magick” without the quotes of course.
Third party software required

Next up, let’s install the third party software we need. Unfortunately, the Appcelerator documentation doesn’t mention any of it and it’s all left to the imagination of the developer. Let me save you from the trouble of figuring out what and how you have to install.

The very first prerequisite is installing Python 2.6 from from http://www.python.org/download/releases/ (tested with 2.6.6). Next, let’s put Python in your path. Hit the Windows key + pause, click on Advanced system settings from the left bar, click on the Environment variables button, double click on path, append “;c:\Python26” without the quotes of course.

You will also need to install WiX from http://wix.sourceforge.net/downloadv3.html. This is required for Titanium to be able to build the installer executable file of your application. Download and install the regular MSI package, NOT the 64-bits one even if you have a 64-bit version of Windows. Remember that all Titanium apps run in 32-bits mode and need a 32-bit installer. During installation, ignore any warnings about missing Visual Studio.
Building your application

The good news is that you can build your Titanium application’s installer manually. The bad news is that you have to use the command line to do that. If you are afraid to use the command line (CMD.exe) or have no idea about DOS commands, tough luck. Otherwise, you can read on.

Very important note: Your application version number must be in the x.y.z.w format, where x, y, z and w are integers. For instance, you can’t use a version number like 1.0.a1 or your packaging job will simply fail.

I will assume that you are building an application named MyApp placed on your desktop in a directory named MyApp. If no such directory exists already, create the directory win32 inside the dist folder placed by Titanium Developer inside the MyApp directory.

Open a command prompt. Just hit Windows key + R, type in “cmd” without the quotes and hit the enter key on your keyboard. You are presented with the black command prompt window. Type in the following command:

python “c:\ProgramData\Titanium\sdk\win32\1.1.0\tibuild.py” -v -o win32 -t network -s “c:\ProgramData\Titanium” -a “c:\ProgramData\Titanium\sdk\win32\1.1.0” -d “MyApp\dist\win32” -p test.exe “MyApp”

You may notice something strange, the test.exe parameter. For the life of me, I don’t know why this is required. No idea, really. It is not used anywhere, but it just seems that if it is not specified the packaging will fail with a cryptic message about the wrong drive being specified!

If you did everything as I described, you now have a MyApp.exe installation package in MyApp\dist\win32. You can distribute that to your users.
The sexy stuff: customizing the installer

As you may have noticed, the installer’s stock artwork has a strong reference to Appcelerator’s Titanium brand. If you want to customize the installer’s header, all you have to do is replace C:\ProgramData\Titanium\sdk\win32\1.1.0\default_banner.bmp with one of your liking.

Accessing LVM2 In Windows

Source: http://www.squidoo.com/accessing-an-lvm2-volume-in-windows

If you use both windows and Linux in a dual booting environment, sharing volumes between them is a common requirement. As volume systems go, LVM2 is very handy and progressive.

However, getting to a partition setup with LVM2 while Windows is booted can be a problem. How can this be done in fail safe way?

I tried a number of methods, which I will discuss, but to get you to the information you want first, I will show the one thing that worked first. This method will consistently work even on something else, like a Mac or Solaris box, as well as with Windows 2k, XP, Vista and Windows 7. I have not tried it on earlier versions like Windows 98.

Some of the other methods worked with varying success until I upgraded to Windows Vista. Here I explain a method that consistently works for accessing Lvm2 in Windows, is free and relatively easy to set up.
Contents
Why use LVM2?
The method that worked – Virtual Box
How it appears to Windows
Obtain and install virtual Box
Set Virtual box To Run As Administrator
Finding the drive number in Windows Vista
Make profile for raw disk access
More Info on Windows/Linux environments
Install OpenFiler
Extend your LVM2 Partition
Love This Lens?
Bookmark This Lens
What are your experiences with LVM?
LVM2 and Linux Links
Image Sources
About Me
Covering a very difficult techie area
Why use LVM2?
LVM2 stands for Linux Volume Management. This system is amazing, because you can have one initial drive or group of drives in a volume, and then add drives to it later if you need more space.

A volume is in this context one logical partition – a single file system. Files are portable across the drives or physical partitions that make up the volume – a volume group.

When you need to take away a drive, provided you have sufficient space on the rest of the physical partitions in the volume, you can instruct LVM2 to ensure that the data is distributed so that no data remains on the volume to be removed. You do not manually have to move your files – and it is still considered one complete logical volume.

If you find that you use a lot of disk space quickly, LVM2 is a very good option to future proof yourself a bit.

Western Digital WD Elements 2 TB USB 2.0 Desktop External Hard Drive

Amazon Price: $125.00 (as of 02/04/2012)

Western Digital My Passport Essential SE 1 TB USB 3.0 Portable External Hard Drive (Black)

Amazon Price: $121.99 (as of 02/04/2012)

Vantec NexStar TX 2.5-Inch SATA to USB 2.0 External Hard Drive Enclosure

Amazon Price: $6.99 (as of 02/04/2012)
The method that worked – Virtual Box
After trying a number of methods, the one that worked is to use Virtual Box.
Virtual Box allows a user to set up a Virtual Machine – a simulated computer running as software. It uses hardware to accelerate where possible, but it is a sandbox, where the programs running in it are separated from your main operating system. Put simply – it allows you to run Linux within Windows, or Windows within Linux as well as multiple Windows instances and so on.

Virtual Box is also free for personal use.

This method involves in short putting Linux on a virtual box, mounting the drive on the Virtual Machine, mounting the LVM2 partition on Linux, using Samba to share the mounted partition. It means that you will be able to have full browsable read and write access to the drive. By using a minimal Linux installation, you will be able to keep the overhead down by a huge amount.

Buy at AllPosters.com
Framed Mounted
How it appears to Windows
Windows will be able to mount a shared drive, which as long as sensible names are chosen, should be easy to find. To windows it would appear to be a normal windows share. Since it is actually local, and written directly to the hard drive, it should be relatively quick.

The virtual machine will be running but it can be set up to run without a GUI, and as a service – so it will become transparent once fully configured. The interface through Windows is the tip of an iceberg. The busy Linux system now become the hidden depths of something that just works.

Buy at AllPosters.com
Framed Mounted
Obtain and install virtual Box
Virtual Box is free, and really easy to get hold of.
Download Virtual Box.

Run the downloaded file to install it. On Vista you will need to give it permission to install. You can choose to use VMware or colinux for this, but the procedures will be different and your mileage with raw disk access may vary on them. I chose Virtual Box as this has worked every time for me.
Set Virtual box To Run As Administrator
Raw disk access requires admin priviledges

Bring up the properties dialog on the shortcut you will use to start it. I chose to do both the start menu one and the desktop one so Launchy can be used. Select the “Shortcut” tab and click the “Advanced” button highlighted.
Bring up the properties dialog on the shortcut you will use to start it. I chose to do both the start menu one and the desktop one so Launchy can be used. Select the “Shortcut” tab and click the “Advanced” button highlighted.
On the Advanced properties dialog, tick the “run as administrator” box, and hit Ok.
Finding the drive number in Windows Vista
You will need this to create write though access to the drive

First bring up the control panel. In the Windows Vista Control Panel, select System and Maintenance (highlighted in red).
First bring up the control panel. In the Windows Vista Control Panel, select System and Maintenance (highlighted in red).
Once in System and Maintenance, look for Administrative Tools, under this there will be an item “Create and format hard disk partitions” (highlighted in red). Click this to see Disk Management.
Once on the disk management Window, the disks will be displayed. Note that non-windows partitions will not have any labels, so you will need to note the disk which has a bunch of non-labelled partitions. Here there is a tiny 125mb boot, a larger 4gb swap, followed by the 293 gb LVM partition – which marks it out as my Linux drive.
Make profile for raw disk access
Currently this is the least friendly part of the process and involves a command line. It is also the most crucial step.
If you want to find out more on this, I suggest reading section 9.9 of the Virtual Box user manual. Here are the steps outlined:

Consider the path you want to create a virtual disk at – For now I suggest c:\users\<username>\rawdisk.vdmk. You can move it once you have done this.

Click start, run then type “cmd” and hit enter.

Type “cd c:\program files\Sun\xVM VirtualBox\” so you are in the Virtual Box program directory.

For the required disk or partition (changing paths as necessary):
VBoxManage internalcommands createrawvmdk -filename c:\users\<username>\rawdisk.vdmk -rawdisk \\.\PhysicalDrive0 -register

That last command line explained:

internalcommands selects a lower level command set in VboxManage

createrawvmdk instructs it to create a VMDK for raw drive access

-filename specifies the output filename for the VMDK

-rawdisk specifies the drive number. Note the notation here – the correct drive number, obtained from the previous step should be used here.

-register ensures that the newly created drive is registered (via the registry) with Vbox and will show up in the virtual box media manager – which will save you plenty a little fiddling and trouble later.

More Info on Windows/Linux environments
If, like me, you have a mixed environment where you regularly use both OS’s, there are a number of tips and tricks you will need to really get the best of the situation.

Linux Kernel in a Nutshell (In a Nutshell (O’Reilly))

by: Greg Kroah-Hartman

Amazon Price: (as of 02/03/2012)

Linux in a Windows World

by: Roderick W Smith Ph.D.

Amazon Price: $20.00 (as of 02/03/2012)

Windows and LinuxIntegration: Hands-on Solutions for a Mixed Environment

by: Jeremy Moskowitz, Thomas Boutell

Amazon Price: $22.73 (as of 02/03/2012)
Install OpenFiler
A reader put me onto this, as a much simpler way to get an LVM or other linux partition mountable for windows. This is to use the system Openfiler. Having tried it out – I agree and this has replaced the original Ubuntu GEOS recommended in this artical.

Setting up a virtual box filer install to get to an LVM drive (or LVM image)
Download OpenFiler – http://www.openfiler.com/ – it is a Free, Open source NAS/Drive management distro. It happens to have LVM setup available and configurable from a web interface. This will be by far the simplest way to gain access. Get an ISO disk image – you will want the latest x86 edition.

Set up the OpenFiler VM – open up virtual box, click “New” to create a new VM, then give it the name OpenFiler. Give it some memory – I’ve given it a gig, which may be too much. Create a virtual disk image for it – I gave it 8Gb – which again may be too much – it is the default.

Be sure to set networking to bridged or host-only as you’ll need to connect to this device. Other options require more configuration usually.
Boot it, and press enter. Skip the disk check.

Once the GUI shows up – follow this: http://www.openfiler.com/learn/how-to/graphical-installation.

The installer will complete and you’ll be asked to reboot.

OpenFiler will start.

It’ll display the IP/url to use – pop this into a browser and you should see the openfiler page load up.

You’ll now need to stop it, and add your drives to it – this is easier for images than physical drives. Look belwo for the steps to add those.

Restart it, and you can now manage your drives from the web interface.

Default login is openfiler, password.

FAFFING – had to try the intel (not AMD) virtual network.
DHCP – You may want to give it a static address – although it will tell you on boot what its initial adress is.
Extend your LVM2 Partition
Why not take advantage of the power of this system by extending your drive space? With an LVM2 partition, you do not need to manually copy files to the new driven and you can keep the old drive so you end up with a much larger net volume size.

Three Ways To Access Linux Partitions (ext2/ext3) From Windows On Dual-Boot Systems

This article was originally published here



If you have a dual-boot Windows/Linux system, you probably know this problem: you can access files from your Windows installation while you are in Linux, but not the other way round. This tutorial shows three ways how you can access your Linux partitions (with ext2 or ext3 filesystem) from within Windows: Explore2fs, DiskInternals Linux Reader, and the Ext2 Installable File System For Windows. While the first two provide read-only access, the Ext2 Installable File System For Windows can be used for read and write operations.

I do not issue any guarantee that this will work for you!

Reverting back to windows boot loader

1. Remove the Ubuntu partitions (EXT3 and SWAP) and resize the Windows partition (NTFS) to use that space.

To do this, you can follow the blog post I made which uses the Gparted LiveCD. The NTFS partition is Windows, and the EXT3 and SWAP partitions were created by Ubuntu.

http://useopensource.blogspot.com/2006/12/easy-way-to-resize-hard-drive.html

2. Fix the MBR (Master Boot Record) so that Windows will boot, instead of GRUB.

Boot from the Windows XP CD.
Rress the “R” key in the setup to start the restoration console.
Select your windows XP installation from the list, and enter the administrator password.
Enter the command: “FIXMBR” (without the quotes) at the input prompt and confirm the next question with a “Y” (without the quotes).
Use exit to restore the computer.

If you do not have your Windows XP cd, then you can use the SuperGrub LiveCD to fix your MBR.

http://supergrub.forjamari.linex.org/

Another option is to boot to a floppy and use “FDISK.EXE /MBR”, but the first two options are much better. Good luck!

Creating Bootable USB for Windows 7

This guide works 100% for Vista & Windows 7 unlike most of the guides out there. I have seen many sites/blogs that have “Install Vista from USB guide” but either with incomplete steps or not working guide. I have also seen some guides that don’t’ use proper commands in this guide. After spending many hours I have come up with this 100% working guide.

Bootable USB drive

I just did this method on one of my friends machine and installed the new Windows 7BETA. The main advantage is that by using USB drive you will be able to install Windows 7/Vista in just 15 minutes. You can also use this bootable USB drive on friend’s computer who doesn’t have a DVD optical drive.

The method is very simple and you can use without any hassles. Needless to say that your motherboard should support USB Boot feature to make use of the bootable USB drive.

Requirements:

*USB Flash Drive (Minimum 4GB)

*Windows 7 or Vista installation files.

Follow the below steps to create bootable Windows 7/Vista USB drive using which you can install Windows 7/Vista easily.

1. Plug-in your USB flash drive to USB port and move all the contents from USB drive to a safe location on your system.

2. Open Command Prompt with admin rights. Use any of the below methods to open Command Prompt with admin rights.

*Type cmd in Start menu search box and hit CtrlShiftEnter.

Or

*Go to Start menu > All programs > Accessories, right click on Command Prompt and select Run as administrator.

3. You need to know about the USB drive a little bit. Type in the following commands in the command prompt:

First type DISKPART and hit enter to see the below message.

Bootable USB Drive

Next type LIST DISK command and note down the Disk number (ex: Disk 1) of your USB flash drive. In the below screenshot my Flash Drive Disk no is Disk 1.

4. Next type all the below commands one by one. Here I assume that your disk drive no is “Disk 1”.If you have Disk 2 as your USB flash drive then use Disk 2.Refer the above step to confirm it.

So below are the commands you need to type and execute one by one:

SELECT DISK 1

CLEAN

CREATE PARTITION PRIMARY

SELECT PARTITION 1

ACTIVE

FORMAT FS=NTFS

(Format process may take few seconds)

ASSIGN

EXIT

Don’t close the command prompt as we need to execute one more command at the next step. Just minimize it.

Bootable USB Drive

5. Next insert your Windows7/Vista DVD into the optical drive and check the drive letter of the DVD drive. In this guide I will assume that your DVD drive letter is “D” and USB drive letter is “H” (open my computer to know about it).

6. Maximize the minimized Command Prompt in the 4th step.Type  the following command now:

D: CD BOOT and hit enter.Where “D” is your DVD drive letter.

CD BOOT and hit enter to see the below message.

7. Type another command given below to update the USB drive with BOOTMGR compatible code.

BOOTSECT.EXE /NT60 H:

14

Where “H” is your USB drive letter. Once you enter the above command you will see the below message.

8. Copy your Windows 7/Vista DVD contents to the USB flash drive.

9. Your USB drive is ready to boot and install Windows 7/Vista. Only thing you need to change the boot priority at the BIOS to USB from the HDD or CD ROM drive. I won’t explain it as it’s just the matter the changing the boot priority or enabling the USB boot option in the BIOS.

Note: If you are not able to boot after following this guide means you haven’t set the BIOS priority to USB. If you got any problem in following this guide feel free to ask questions by leaving comment.

How to stop windows making automatic diskcheck on start up

There are some people suggested to edit the registry but the proper way to disable CHKDSK from starting up is using the /x switch on chkntfs command in command prompt. The /x switch will exclude a drive from the default boot-time check. If you have drive C: as your hard drive, then the command to disable chkdsk from scanning C: drive would be:

chkntfs /x c:

If you have 2 drive, C and D, you can disable chkdsk with the command below

chkntfs /x c: d:

then go ahead and reboot.

%d bloggers like this: