Sunday, October 06, 2013

Determining if your system is a 32bit or 64bit system via PowerShell

During my spare time here in Honduras, I am doing some freelance work for companies via various sites on the web. One of these tasks asked me to build a PowerShell script to perform some basic tasks, however there has been 1 snag - 32bit or 64bit OS?
I need to determine the OS version to execute the right commands, at first this is an easy thing to find, look in the Win32_OperatingSystem for the OSArchitecture attribute. If it's 32bit, then the OS is 32bit, otherwise it's 64bit.

However, a problem comes up with Windows XP systems - they don't have this value in WMI. When I wrote the script initially, I assumed that XP systems were out of scope due to their age (probably silly). So out to the internet I go and I find tons of methods to determine if the OS version is 32 or 64bit.
The most complete posting I have found was at http://depsharee.blogspot.com/2011/06/how-do-detect-operating-system.html, and it seems to suggest that the Win32_Processor.AddressWidth is the ideal WMI key to use. This works in Windows XP through 2012, so it should cover all of my needs.

Another option that isn't listed is to use the Test-Path PowerShell command. 64bit Operating Systems create a folder named C:\Program Files (x86) to separate 32 and 64 bit applications. We could then check for this path to see if the OS is running 64bit. This probably isn't the most reliable method as the OS could be installed on something other than the C:\ drive and with different default locations, but if you are only looking for a file to execute, it may be a shortcut.


Wednesday, October 02, 2013

Rolling your r´s in Spanish

It´s been a little over a year now that Jana and I have been in Honduras. A lot has happened in the past 12 months, including learning how to (poorly) speak Spanish from almost nothing. Jana is doing better than me, but I still have a long way to go - why didn´t I pay more attention to Spanish class in High School?

Learning vocabulary and grammar are fairly simple - start out with some rules and dictionary and practice. However, the one thing about Spanish that I still hadn´t figured out is the rolling of the r.

For example, take the following words: perro and pero. The first is a dog, and the second means ´but´. There are many words like this in Spanish that mean 2 different things, and it is often difficult to say what you mean when you can´t roll the r. Another example: carro y caro. The first is a car that your would drive, and the second means expensive. So it is possible to have a conversation with someone where you are talking about your "caro carro".

Being a child of the internet, I decided to try google. A quick search and I came up with http://www.wikihow.com/Roll-Your-%22R%22s, a nice how-to that describes a few methods of rolling your r´s. I personally have found the "DR" method the easiest - so instead of trying to say carro, I try to say cadro. I dont know if this sounds right to everyone else, but at least it can be understoon.