Windows: The Hosts file – Three good reasons to use it.

The host file is best known by administrators for its misuse by malware creators (Pestilent Hordes). In this post I will describe the host file and three good reasons to use it.


The hosts file is a non-suffixed file that resides in the following location: c:\Windows\System32\Drivers\etc


Its purpose is to help resolve names to IP addresses much like DNS. The important thing to understand about the Hosts file is that it can be used to preempt DNS queries and thus the reason why Malware providers have been known to misuse the file. Here are some legitimate uses.


  1. To find internal resources to which there may not be a DNS entry or to which the DNS server may not be authoritative for. This is useful in migration and other scenarios where two distinct networks exist on separate subnets and IP ranges.
  2. In small networks where you do not have filtering of inappropriate websites the hosts file can be used to route website requests to the loopback IP otherwise known as 127.0.0.1. The net results is that the website will not resolve properly.
  3. In test scenarios in a development environment where you might want to test the resolution of names and various resources before the actual website goes public.

There are a number of other reasons why the Hosts file is useful however these are three which are used commonly.


For more information on the Hosts file:

Hosts file – From Wikipedia
http://en.wikipedia.org/wiki/Hosts_file


 Microsoft TCP/IP Host Name Resolution Order
http://support.microsoft.com/kb/172218


Jeff Loucks
Available Technology
Available Technology
  Subscribe in a reader 

Dynamics CRM: Data Import removing non-printable characters

The more experienced you are with data imports the simpler you want to make the process. Last week I was at the Microsoft MVP summit in Redmond Washington. While I was there I spent a good deal of time with my Dynamics CRM MVP buddies among others. At breakfast one morning I sat with a bunch of Access MVPs. On the way back I ran into a great SQL Server MVP in the Washington Dulles airport. It was during these conversations that I realized people were using the same complex methodologies I had in the past to clean data before importing it in to CRM or other database applications. For that reason, I thought I would document this simple technique to help ready data for importation in to CRM.


The old faithful in database imports is the trusty comma separated value (CSV) file where data is kept in a text file and Fields are separated by commas. When all else fails in exporting data, comma separated values is the base format that every program seems to support. If you are working with CSV files, Microsoft Excel is your best friend.


What is a non-printable character?


The most common non-printable characters are a space, tab or carriage return. In total there are at least 27 different non-printable characters. They are tricky because you can’t see them in the text and often they disrupt normal processing of the import tools you are using. For more information on non-printable characters please see  the following resource:


Wikipedia: Control Characters
http://en.wikipedia.org/wiki/Non-printable_character


MSDN: Non-Printable in Jscript
http://msdn.microsoft.com/en-us/library/218s85f8(VS.80).aspx


Using Excel to Clean Data:


Excel has several great features for working with text. I am going to focus on the ‘Clean’ function.


In the following example I have a sample text block which has non-printing characters to cause line breaks in the cell. These are common in Address fields and note fields.


The following shows the second sheet which references the first. Note the clean function in the data value box.


Note that the entire value is on the same line and the non-printable characters have been stripped out.


Here is the description of the Clean function from Excel 2010 help:


Removes all non-printable characters from text. Use CLEAN on text imported from other applications that contains characters that may not print with your operating system. For example, you can use CLEAN to remove some low-level computer code that is frequently at the beginning and end of data files and cannot be printed.


Important   The CLEAN function was designed to remove the first 32 non-printing characters in the 7-bit ASCII code (values 0 through 31) from text. In the Unicode character set (Unicode: A character encoding standard developed by the Unicode Consortium. By using more than one byte to represent each character, Unicode enables almost all of the written languages in the world to be represented by using a single character set.), there are additional non-printing characters (values 127, 129, 141, 143, 144, and 157). By itself, the CLEAN function does not remove these additional non-printing characters. For an example of how to remove these additional non-printing characters from text, see Remove spaces and non-printing characters from text.


Syntax
CLEAN(text)The CLEAN function syntax has the following arguments (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.):


Text   Required. Any worksheet information from which you want to remove non-printable characters.
Example
The example may be easier to understand if you copy it to a blank worksheet.


Jeff Loucks
Available Technology
Available Technology
  Subscribe in a reader 

Windows Powershell Documentation Review

Want to get informaiton on powershell before almost anyone else? Help Microsoft review their new documenation which is geared for beginers to intermediate level users.


Windows PowerShell Community Review


Have you ever read Help that wasn’t really helpful? Here’s your chance to fix it.


The Windows PowerShell documentation team and PowerShellCommunity.org jointly sponsor the Windows PowerShell Community Doc Review. As a member, you’ll get to read and comment on the Help docs before they’re published, and work with the writers, editors, and the product team to make sure every word is really helpful.


We’re looking for users at all experience levels and with all different backgrounds, but we love to have beginners, people with no programming experience, people who know other scripting languages or shells, and people who are not native English speakers. If you’re a system admin and you don’t really know Windows PowerShell, this is a great way to learn it with help from insiders.


Ready to rock the help? Contact June Blender (juneb@microsoft.com) or Marco Shaw (marco.shaw@gmail.com).


Jeff Loucks
Available Technology
Available Technology
  Subscribe in a reader