Sunday, October 30, 2011

Installing a 2.5" Laptop Drive into an Empty Floppy Drive Bay

My company decided to standardize our computers more than previously. For Desktop computers, this meant the Dell Optiplex 980. These have full-size DVD drives, but otherwise no extra room for extra hard drives.
Being a tech, I needed more "working space" than a regular computer, plus I wanted extra local storage to blow away my C: drive and re-image on a whim. So I decided to try installing a laptop drive into the empty floppy drive bay. That really was the only choice inside the crapped case.
I took the steel floppy drive blank filler home and carefully marked and drilled three holes for mounting. Then I cleaned the holes up.
Back at work, I grabbed three rubber pointer nubs - those extras that come with laptops in case you need to replace the little finger nub in the middle of the keyboard that no one seems to use. Quite a few of them have accumulated over the years. I drilled them out so that a screw would fit through them. These were my shock-mounts.
Last, I chose three longer screws so that they would bottom-out inside the threaded holes in the hard drive case. This is so the screws would resist unscrewing. Since I was using shock-mounts, I wouldn't be able to screw the hard drive rigidly against the steel bay, so the screws either needed Locktite or they needed to bottom-out.
It was a quick and easy project.







Tuesday, May 3, 2011

Simple Sysprep for Enterprise

I've already posted about eSATA, and how once you've built your PC with the wrong BIOS setting, then changing the BIOS will cause a BSOD. The answer was to Sysprep the machine and then change the BIOS. If your computer is fully built, you'll want the least damage done to your computer. Basically, you just want to rip the hardware profile out so that it rebuilds on the next reboot.
Through much trial-and-error, I came up with the following two-part system.

A script, SysprepLaunch_x64.cmd, that contains only the following...
net stop wmpnetworksvc
sysprep /generalize /oobe /shutdown /unattend:unattend_x64.xml


I stumbled across a few posts where they found that the Windows Media Player sharing service can ruin Sysprep, so I start by stopping the service. Then I launch Sysprep, calling the answer-file.

The answer-file was the hard part.
The answer-file below is for x64 only. To tailor it for x86, simply replace processorArchitecture="amd64" with processorArchitecture="x86".

The unattend_x64.xml answer-file

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SystemLocale>en-us</SystemLocale>
<UserLocale>en-us</UserLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-us</UILanguageFallback>
<InputLocale>0409:00000409</InputLocale>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<ProductKey>
<Key><span style="font-weight:bold;">XXXXX-YOUR-WIN7X-KEYXX-XXXXX</span></Key>
<WillShowUI>OnError</WillShowUI>
<!-- <WillShowUI>Never</WillShowUI> -->
</ProductKey>
<Organization>Loose Screw</Organization>
<FullName>Administrator</FullName>
<AcceptEula>true</AcceptEula>
</UserData>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Reseal>
<Mode>OOBE</Mode>
</Reseal>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OOBE>
<ProtectYourPC>1</ProtectYourPC>
<NetworkLocation>Work</NetworkLocation>
<HideEULAPage>true</HideEULAPage>
</OOBE>
<TimeZone>Mountain Standard Time</TimeZone>
<AutoLogon>
<Password>
<Value>h@rdpa$$w0rd</Value>
<PlainText>true</PlainText>
</Password>
<Username>Administrator</Username>
<Enabled>true</Enabled>
<LogonCount>5</LogonCount>
</AutoLogon>
<UserAccounts>
<AdministratorPassword>
<Value>h@rdpa$$w0rd</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>PASSWORD HERE</Value>
<PlainText>true</PlainText>
</Password>
<Name>PC Central</Name>
<Description>Local Administrator</Description>
<DisplayName>IT Central</DisplayName>
<Group>Administrators</Group>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<OEMInformation>
<Manufacturer>Dell</Manufacturer>
<HelpCustomized>false</HelpCustomized>
<SupportURL>http://support.dell.com/support/index.aspx?c=us&cs=04&l=en&s=slg</SupportURL>
</OEMInformation>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Description>Activate Windows 7</Description>
<CommandLine>"cscript C:WindowsSystem32slmgr.vbs -ato"</CommandLine>
<Order>1</Order>
</SynchronousCommand>
</FirstLogonCommands>
</component>
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>en-us</InputLocale>
<SystemLocale>en-us</SystemLocale>
<UILanguage>en-us</UILanguage>
<UILanguageFallback>en-us</UILanguageFallback>
<UserLocale>en-us</UserLocale>
</component>
</settings>
<cpi:offlineImage cpi:source="wim://SERVER1/install.wim#Windows 7 ENTERPRISE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

Friday, April 22, 2011

Configuring Virtual Machines and Hosts

Last time, I covered setting up Windows 7 to run XP virtual machines. What came next was figuring out how to setup VirtualPC optimally.

First, make sure that Virtualization Technology is enabled in your BIOS, if such a setting exists. Without it, VirtualPC can't take full advantage of the host's hardware if this is not enabled. This would mean you can't run CAD, GIS, or play games, which need a closer relationship to available hardware. Since nearly everything to do with hardware is "emulated", hardware intensive apps won't run on VirtualPC without Virtualization Technology enabled.

Memory
The goal is to have enough memory for both the host and the VM, while minimizing paging operations. Robbing the host of too much memory is worse than robbing the VM. So the host should get the priority. If the host is slowed down, it will slow the VM down, so there’s no winning way to give a VM very much more than it will ever need.
1. First, log onto the host and launch all the applications you’re used to running. Let all initial processing (AV def update, AV initial scan, email sync with server, etc.) finish until the computer comes to rest.) You might want to launch maybe one or two more apps, especially if there’s an app you use maybe once every day, even if you don’t leave it running all the time. Especially launch any memory-hogs you use regularly.
2. Bring up Task Manager and go to the Performance tab. Look at the bottom under Physical Memory and note how much memory is available.


In this example, we have 2336MB.
Now subtract about 200MB for additional applications. This totals 2136MB available (max.) for the VMs to use.
3. Repeat this process for each virtual machine, but don’t just record “Available” – figure out how much is used.



In this example, the VM has been pre-configured on the host to allow 1024MB of memory to the VM. It is only using 593.3MB (1048048 – 454696 = 593352). Add ~35MB for additional applications. The VM actually needs 629MB.

Adding additional memory, above what your VM needs, will not speed it up. It will only allow you to run more applications. Most VMs are dedicated to 1-3 specific legacy applications, and no more. So it is best to allot barely more than the minimum. If your VM becomes sluggish, you might want to double-check your VM memory usage as time goes on. Newer versions of applications usually use additional memory, as the trend is towards code-bloat. If your host has more than enough memory, you might want to allow your VMs 100-200MB more, to allow for memory-hogging upgraded applications, like newer versions of IE, new OS Service Packs, etc.) as the years go by. This way you’re not hassled with VM configuration maintenance in the future.

4. So the last step is to reconfigure Virtual PC. Since 4GB on the host is a healthy quantity, I rounded 629MB upward to ¾ of a gig. I changed 1024MB to 768MB.



After making the change, and launching my VM, I see the host still has just over 1702MB available. The VM still has 203MB available.

Networking
- Dual NICs
Some machines have more than one NIC available. Our Server group advises against this practice, as it has caused issues with DNS and/or AD. However, it is possible to configure your host to use one NIC exclusively, while configuring your VM to use the other exclusively.
Since our Server group advises against dual NICs, I will only mention it, not detail the steps, since I don't have experience with it.

- No NIC Found
If your VM can’t find an available NIC, then make sure you have the latest version/patch-level of Virtual PC and that “Integration features” are enabled.



Then make certain the appropriate host computer’s NIC is selected in the VM settings…



"Turn off" versus "Shutdown"
“Turn off” is not accurate. This term refers to yanking the power cord. This is only good if the VM is attacked by a virus, or a similar panic situation.
“Shutdown” is a normal, controlled shutdown, where any open apps will be closed, and temporary files released.

Slow Explorer Access Between host and VM
There’s a problem with some VMs copying files from the host hard drive – phenomenally slow. There are a few possible fixes…

Method 1
The 1st method is for servers, not clients. Follow the hyperlinked text above if you want the details.
Method 2
Disable TCP task offloading in the registry of the host computer. To do this, add the following value.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"DisableTaskOffload"=dword:00000001
Restart your computer for it to take effect.
Method 3
Most NICs don’t have the choices detailed in Method 3, so don’t be surprised if Method 2 is the only one available.
If you do not want to disable TCP segmentation offloading on the whole system, and you want to only disable TCP segmentation offloading on the network adapters that Virtual Server guests use, you must not add the DisableTaskOffload registry entry that is described in Method 2. Instead, you can disable the task offload properties on the Advanced tab of the Properties dialog box of the network adapter.

To disable the task offload properties, follow these steps:
1. Click Start, click Run, type ncpa.cpl, and then click OK.
2. Right-click your network adapter, and then click Properties.
3. Click the General tab, and then click Configure.
4. Click the Advanced tab.
5. In the Property box, click the Offload TCP Segmentation property.
6. In the Value list, click Off, and then click OK.
7. If you also have the following task offload properties in the Property box, you must repeat step 5 to step 6 to disable these properties:
o Offload Receive IP Checksum
o Offload Receive TCP Checksum
o Offload Transmit IP Checksum
o Offload Transmit TCP Checksum
Sysinternals has a Secure-Delete utility that some say improves performance of VM’s. I’m not sure how or why it would, but for what it’s worth, they say to run the switch to clean empty space on the host hard drive where the VM’s VHD resides…
:: usage: sdelete [-p passes] [-s] [-q]
:: sdelete [-p passes] [-z|-c] [drive letter]
:: -c Zero free space (good for virtual disk optimization)
:: -p passes Specifies number of overwrite passes (default is 1)
:: -q Don't print errors (Quiet)
:: -s Recurse subdirectories
:: -z Clean free space
sdelete.exe -c C:

Hard Drives

It will give better performance for both the host and VM if the VM is on a different physical drive from the host OS. This is often not possible, but it is more ideal.
This may not be true for external drives – it depends on the overall data-rate. Alleged speeds are never reached, and some connections may be running at 1/20th the rated speeds, for whatever reason. Running from a mapped network drive is a very bad idea.
It’s also good to keep disc fragmentation to a minimum, on both the host and the VM.

Virtual PC and XPMode

Many of you may work in a corporate environment with Volume Licensed Mircosoft products. Moving to Windows 7 from Windows XP (nearly every company skipped Vista) can be difficult. The biggest headache is compatibility. The solution is often to include a Windows XP virtual machine with every new Windows 7 machine.

Installing
Install Virtual PC first, either x86 or x64 for your OS type...
Windows6.1-KB958559-x64-RefreshPkg.msu
Windows6.1-KB958559-x86-RefreshPkg.msu

Then install Windows XP Mode...
WindowsXPMode_en-us.exe

Update for Windows XP SP3 to enable RemoteApp (install on your VM)...
KB961742-v3.exe

The first one is installed into Windows 7 to allow you to run a virtual machine. WindowsXPMode allows you to create a Windows XP virtual hard drive with Windows XP on it, and then to run applications inside the XP VM without manually launching VirtualPC.
This is a big download because the Windows XP CD is included within the installer. Every Vista and Windows 7 install comes with a Windows XP license at no extra charge. Microsoft did this to allow you to work around compatibility issues. When all else fails, run in from a virtual machine.

Copying your Volume Licensed XP Virtual Machine
In a corporate environment, with Volume Licensed products, there's a problem. The WndowsXPMode VHD that gets created automatically is an OEM license, not a VL license. So in a corporate environment, don't bother going through the XPMode wizard to create the image. You'll have a production-line of new computers anyway.
So one problem is your license, but another is that each VM has to be set up the way real, physical machines are set up, if they are going to be 100% functional. Our domain has quite a few web-based systems everyone needs access to. Some don't yet work with IE8, much less IE9. Some don't work on Windows 7. Many server-based applications automatically grab the logged-on user's credentials. This means an OEM license is not legal, and your VM will have to be joined to the domain like a real machine. So you need to build a VHD/VM using your Volume Licensed copy of Windows XP. Every Windows 7 machine will have to have Virtual PC and WindowsXPMode installed, and you'll have to copy your XP VM to every new Windows 7 machine.

I've decided, since multiple users sometimes use one machine, that I would store the VHD here: D:\VirtualMachines\WinXPMode\WinXPMode.vhd

Microsoft designed Virtual PC in a clunky per-user manner, storing the VHD within profiles. To me, this is crazy. On a multi-user computer, this means every user gets their own separate VHD that is several gigabytes in size! This might even be a license violation, since each Vista or Win7 machine is only allowed one XP license. But that depends on the fine-print (since only one person at a time can actually use a computer, only one VM will be running).
I move it to the D: partition where everyone can get to it.
Unfortunately, every user who logs on has to run the VPCWizard located here...
C:\Windows\System32\VPCWizard.exe
And Microsoft didn't bother to create a menu shortcut for you (did they really think this through?)

Setting up your XP VM
I unplug the network wire on my Win7 host machine and launch the VM. I run Sysinternals' NewSID (sorry folks, this is no longer included within Sysinternals' package because it ruins Windows 7 and Vista. Maybe you can still find it somewhere else? Or use something else.
I rename the VM the same as the computername, but with an extra "VM" tacked onto the end. That way, when looking at computers on a domain, and you see \\Q123456 and \\Q123456VM, you know the the latter is a VM being hosted by the former.

After the VM reboots with a new SID and name, I join it to the domain.
Every new user added to the VM has to run VPCWizard to create individual *.vmc and *.vmcx files. These will be stored in the individual user Profiles pointing at the common VHD on the D: drive.

Thursday, February 24, 2011

This is Why I didn't Buy WP7 Yet

10% failure rate of Windows Phone 7 device

If I buy a WP7 phone, it must already have copy-paste capability.
This roll-out is the first one, too, so everyone is a beta tester, whether they intended to be or not.

Saturday, February 12, 2011

AT&T, iPhone, and Verizon

I used to use a Windows smartphone. It did everything I wanted, from spreadsheet creation, cell formulas, Word docs, Internet, texting, and had great service.
Problem was it was analog and analog services were being turned off nationwide. I was forced to switch. Add to that, Cingular got bought by AT&T.
AT&T has always been good at marketing. Grab that customer. The problem was as soon as they have you under contract, they don't give a rats ass about you. They started turning off the digital network for my 1st-gen iPhone.
That's another story... I shopped a LOT! I saw so many posts claiming the iPhone was the "perfect phone". I couldn't do spreadsheets, I never could use the 8GB drive space. "Oh, just jailbreak it." Get real. I don't have time to dink with my phone all the time. Apple fanboys are the most disconnected-from-practical-reality of any creatures on earth. Take reviews with a grain of salt.
Add to the list, AT&T had a monopoly on the iPhone. They could treat you like a floormat, and then say, "Upgrade your phone! Just sign here to renew your contract for another three years."
How's that saying go? Fool me once, shame on you Fool me twice...
So I refused to upgrade, sign, jailbreak, etc. Instead, I've eagerly anticipated the new Windows Phone 7. Unfortunately, it's no better than an iPhone! (I'm not a Windows fanboy, either.) At least it'll do my Office apps, but it's locked-down and restrictive just like an iPhone. Can't carriers just give us what we want without [explitive omitted] with us? WP7 was supposed to be out in September. Then by Thanksgiving. Then before year-end. Then the copy&paste update was supposed to follow early January. Then late Jan. Then Feb. Now March...
Geez.
This whole time, I'm limping by with my crappy iPhone, cuz why replace my current crap with new crap? If I can't get what I want, why bother changing?
Now I'm noticing, since Verizon now offers the iPhone, and Verizon got SWAMPED with buyers (not AT&T), I've noticed that the dead-spots here in Denver are getting service again! AT&T is now caring about customers! See what a little competition does? Exclusive phone offerings should be illegal. Corporate monopolies are illegal. Product monopolies should also be illegal.

Wednesday, February 9, 2011

Check for Caps-Lock in Batch Script

For years, I've had to access restricted network shares, most often when logged on with either local-computer credentials, or as an end-user who doesn't have permission to access the share. So I fire off a script that passes my credentials.

It really sucks when they have caps-lock on, and I don't know it, and lock myself out. Scripts are good about doing that. Since a script can store your credentials and pass it to several different shares, you can get locked out in a split second. You don't have to type your password wrong manually three times.

With 32-bit Windows, there is an old 16-bit executable that can check this. It's called debug.exe, and Microsoft stores it in the wrong place (they do that a lot).
C:\Windows\system is supposed to hold legacy 16-bit files. C:\Windows\System32 holds 32-bit files. So guess where they stuck it? They stuck the 16-bit debug into System32. (It's the Microsoft way.)
Debug.exe won't function on a 64-bit computer, no matter how you try to trick WOW (Windows-On-Windows) into handling it.

Copy the code below and save it in a text file and name it anything ending in .bat or .cmd. Then fire it off with caps-lock either on or off to see the difference.
I've tried it successfully on Windows XP and Windows 7 32-bit. (Beware line-wrapping.)


TITLE DOMAINAPPS tech-share
echo off

:: Check for caps-lock on...
set capslock=0
for /f "skip=1 tokens=2" %%a in ('(echo d0:417,417 ^&echo q^) ^|debug') do IF %%a GEQ 40 SET capslock=1
if %capslock% == 1 cls&echo.& echo CAPSLOCK IS ON!!& color cf& echo.& pause

:: Prompt for username...
cls&echo.&color 1f
set /p useris=Type Your Username:

:: Now pass your credentials...
color 9f
net use \\OurDomain.net\DOMAINAPPS /user:%useris%OurDomain.net
:: And open the share...
explorer \\OurDomain.net\DOMAINAPPS


For x64 Windows, I resort to using Powershell instead of debug.exe. This has the added advantage of working on both 32-bit and 64-bit.
The following code should work, even if a bit slower. (Note that I like to leave Powershell script security on "Restricted", and drop it just-in-time for my command, then raise security back up immediately afterward.)


TITLE DOMAINAPPS tech-share
echo off

:: Check for caps-lock on...
set capslock=0
powershell -command "& {Set-ExecutionPolicy Unrestricted -force}"
for /f "tokens=*" %%a in ('powershell -command [console]::CapsLock') do set capslock=%%a
:: Return the security policy to default, restricted.
powershell -command "& {Set-ExecutionPolicy Restricted -force}"
if %capslock% == 1 cls&echo.& echo CAPSLOCK IS ON!!& color cf& echo.& pause

:: Prompt for username...
cls&echo.&color 1f
set /p useris=Type Your Username:

:: Now pass your credentials...
color 9f
net use \\OurDomain.net\DOMAINAPPS /user:%useris%OurDomain.net
:: And open the share...
explorer \\OurDomain.net\DOMAINAPPS

Tuesday, February 8, 2011

How to Get eSATA to Work

I've had a hell of a time trying to figure out eSATA. My first post mentioned my 32GB Kanguru flash drive that worked on one computer for two weeks and then stopped.
I bought a new computer - obnoxiously fancy - capable of everything and including three eSATA ports. So far, none of them have worked.

I bought a SATA hard drive dock that had both USB2.0 and eSATA, but only the USB2.0 ever worked.

At work, my 2TB LaCie Firewire drive has been failing. It keeps dropping offline. To keep from Blue-Screening, I have to delete it from Device Manager and then unplug it, then re-plug it and wait for it to reinitialize. It's been happening about six times a day. That gets old!

So I bought a nifty little 5-drive AMS RAID box that uses 2.5" laptop drives.

It has USB3.0 and eSATA interfaces. Since computers mostly don't come with USB3.0 yet, I decided to give eSATA one last chance.

Google showed me that there are tons of techies out there who can't get eSATA working, so it wasn't just me.
Here's the deal... the marketing departments virtually lie. Manufacturers know that if they put eSATA on a motherboard, they'll sell more computers, but they don't tell you you can't have both internal RAID 5 and eSATA.

AHCI is a SATA mode required for hot-swapping SATA drives. This is very desirable if you intend to use an eSATA device like a USB flash drive. Yanking an eSATA device out without hot-swap capability will crash your computer, and can damage the device.
When you buy a fancy motherboard that can do anything, they don't tell you that of all the drive options it allows, you can choose only one. My Asus motherboard has a 4-drive RAID 5 main drive, but if you turn on RAID 5, you can't use AHCI mode, so none of my eSATA ports work.
Allegedly, AHCI isn't required for eSATA to work - only for hot-swapping. So allegedly you can still use eSATA if you turn off your computer, plug in your eSATA device, and boot cold. But in reality-land, hardly anyone can get eSATA to work unless AHCI is turned on. And it never seems to be "on" by default.

At work, to get my 2250C mini to work on a Dell Optiplex 980 with Windows 7 x64, I checked the BIOS. Unfortunately it was set to SATA-RAID-ATA. I changed it to SATA-RAID-AHCI and the computer became unbootable and even a repair wouldn't work. So I put it back to ATA, dis-joined it from the domain, and ran Sysprep. Sysprep ripped the entire hardware and drive configuration out and turned-off the machine. Then I set the BIOS to AHCI and booted. Windows built back up and booted fine.
So if you've tried changing the BIOS SATA settings and failed on an in-place machine, Sysprep can be your salvation.

Next, I downloaded the latest BIOS flash, Intel chipset drivers, and AHCI drivers and installed them all. Previous to getting the BIOS set to AHCI, the AHCI drivers wouldn't install. The attempt only told me "computer does not meet minimum specs". But with the correct BIOS setting, the drivers went right on.

Then I installed the RAID management utility. When I plugged my RAID box in, it was easy to set it to RAID 5 and build the array. Then in Windows Disk Management, I formatted NTFS and was done. Five drives, 2TB, and almost palm-sized. Freakin' cool!

Too bad the 32GB Kanguru still doesn't work on the eSATA end. It has always worked on the USB end, and it's still one of my favorite flash drives. Only thing is, the Kanguru dumps regularly. The partition tables or something keep vanishing and all the data on it goes bye-bye. If I kept vital data on it, this would piss me off, but I just have a backup script that I run to snatch loads of the most important personal work files off my work computer to take home and dump on my 5.5TB Drobo. So the data doesn't have to live long, and the script is backed-up.

So here I am with another almost built computer sitting on the floor at home and seeing that I want RAID 5, but also want all the eSATA ports to work, I guess the thing to do is use Solid State Drives. They're faster than RAID 5. You can also get SSD's that fit into PCIe slots, and I can attach a RAID 5 box on the outside, via eSATA. As long as the RAID 5 isn't internal, you can still use it.