grep, in PowerShell

Here is a sample of a PowerShell script that I use for finding text in files, having “grown up” with a more Unix-like syntax. I know, this isn’t exactly a clone of grep‘s functionality, but it gets me closer than having to remember exactly how to wrangle PowerShell’s Select-String commands to my liking. Note that I normally am looking for things recursively, so my script does that automatically.

Param(
  [string]$filename,
  [string]$target
)
ls -r $filename | sls $target

I call that by using an alias, set in my $PROFILE

Set-Alias grep c:\code\ps\Grep.ps1

Then I can just use a command like one of these

c:\> grep \code\*.ps1 version
c:\> grep *.txt hobbits
c:\> grep $HOME alpharetta

Also available, with any changes since this was published, in this repo.

Enabling FTP Server on Windows 10

Almost every article “out there” on setting up an FTP Server on Windows 10 starts with using the “Windows key + X keyboard shortcut to open the Power User control panel” – which doesn’t seem to work/exist on my computer – or to some “Administrative Tools” control panel applet – which also doesn’t exist here. I don’t know; I suspect that the various versions of Window 10 have things moved around so much that nobody’s sure where to find what’s really needed.
Cortana Search Box

As of today, on my computer (which just identifies it’s version as “Window 10 Pro”) this worked.

Type “features” into the Cortana Search Box.
If the search box doesn’t show on your computer, try right-clicking on the taskbar and chosing Cortana > Show search box.

This will get you the Windows Features selection – which should be/has been/might be also available from Control Panel Apps & Features, but isn’t always.

For whatever reason the FTP Server ‘feature’ is tucked into the Internet Information Services section of the Windows Features selection, though most of us might think that’s only for, ya know, Internet Information Server a.k.a. IIS a.k.a. the web server.

Windows Features selector

Now you can use the IIS Manager (again, use Cortana if you need; search for IIS). Right click on Sites and choose Add FTP Site

IIS Mnaager - Add FTP Site

Searching Evernote

I use Evernote. A lot. I’d consider it to be a backup for my brain, except that often it’s more like the primary storage instead of backup. Recipes, lists of books, notes on projects, and much more gets dumped into Evernote for future reference.

Of course, reference requires good methods for browsing and searching. The search box tends to be just about the most-used piece of Evernote’s interface for me.

Evernote with the Search box circled
If you poke through the menus (Edit -> Find), you’ll learn that you can use the Option-Command-F key combination (Opt-Cmd-F) combination [ F6 for Windows users] to jump straight to the search box without having to use the mouse. That’s helpful.

What’s perhaps even more useful, and not found anywhere (that I could find, anyway) in the user interface, is that you can search Evernote from anywhere – yup, as long as Evernote is running, you don’t have to be switch to it first in order to search. While reading this post, for example, or while working on that important report you should be writing, just press the Control-Command-E key combination (Ctrl-Cmd-E) [ Windows Shift F for windows users].

That’s super useful!

(It would be good if the “universal” key combination also worked while in the app; for me, at least, Ctrl-Cmd-E does nothing while Evernote is the foreground app. Having to know two different key combinations is… less than optimal.)

Too Many Choices…

Toshiba Satellite laptopI need a new computer, one that I can use for C# and ASP.NET develoment. Over in the Mac world, choosing a new computer — like so many other Mac things — is easy. If you want a laptop there are basicly six choices. Good, Better and Best, as Sears used to say.

In the PC realm though… well, that’s another matter. First you need to choose a processor, and there’s no shortage there from which to choose. Unlike ‘the good old days,’ you can’t even just assume that a higher model number is ‘better’ or faster, Intel warns that “The processor number is not a measurement of performance.”

Then come the more mundane questions — which of the vendors offer the processor I want with the size (and resolution) screen I want? Memory and hard disk drive are easy, get the biggest available (checking crucial.com‘s prices on memory first, of course). Ignore all the attempts to upsell on software, printers, carrying cases, cameras, USB docks, extra batteries, mp3 players, wireless routers, dog dishes and monogrammed tea towels.

I think I’m close to pulling the trigger; Toshiba has a Satellite L350 that can be customized “in 8-10 business days” for me. But wait, what’s this “Satellite Pro” series….?

A couple of Windows and Exchange Links

del.icio.us and my blog were doing some wacky things this weekend (apparently I had different browsers posting to different del.icio.us accounts), but here are a few posts for you…

  • As much as the common security advice is not to run as Admin, there are a number of tools that simply don’t work without the Admin rights.
  • A list of updates and patches, OS and Exchange Server both, that you should be loading on your new Exchange 2007 installations.

Spyware Cleanup

Mike McB’s Spyware Cleanup is a good series to read through, to learn just how messed up a Windows system can get and some of the tools to use when (not if) you’re in the same situation.

Mike, you’ve got more patience than I do. When I was shown the family PC in similar condition a few months back, I did similar work for a few days. Then I gave up. I checked on the backups, reformatted the disk and reinstalled everything from scratch.

A Clean PC is a Happy PC.

While you’re waiting for the shuttle launch, which apparently now won’t happen until at least Friday morning, take a few minutes to save yourself some time and frustration – go through Tweak3D’ Windows XP 15 Minute Tune-Up:

Don’t throw out that old PC yet!

A fine-tuned Windows XP PC can run quite fast even it’s seriously lacking in the memory and CPU department. Before you chuck out your PC to buy a new one, try stripping some of the rust that’s built-up over the years; the results may surprise you.

The first step – before you even start to clean the crud from your system – is to make sure your processor’s got enough room to do it’s work for you. Stop by crucial.com and run their memory advisor tool. Get that memory ordered and on it’s way while you’re going through the rest of the PC cleanup.

Comparing Operating Systems

OS X vs. Windows XP. Now there’s a debate that normally spirals quickly out of control.

“You get more viruses.”
“You don’t have any games.”
“You’re harder to use.”
“You cost more.”
“Your feet smell.”
“Your mother wears combat boots.”

Fortunately, this site doesn’t go that way, and is surprisingly fair and balanced. They did a good job of not going off the deep end on either platform, pro or con. The numbers look pretty reasonably assigned and the closeness bears out what most non-fanboys would say – that OS X is currently considered slightly better but still needs continuous improvement to stay ahead (especially with Vista just around the corner), and in some ways Windows XP is on top (I’ll take Windows Explorer over OS X’s Finder, and OS X’s method of only having one corner to resize a window aggrivates me).

There are a few possible mistakes (does Windows Movie Maker really ship with Windows XP? I didn’t think so, at least not the most up-to-date version, and I’m pretty sure it’s not possible to buy a Mac without iMovie.) and not having a section on virus’ and malware is disappointing (or maybe that’s because I just spent 20 very frustrating hours trying to clean up the family PC after the kids went “exploring” though some websites they shouldn’t have) but for the most part I’m impressed.

Since each category may be more important to one person than to another, the overall number may be somewhat meaningless. You might weight something heavier than I would; each of our needs are different. But the numbers and explanation of each category are good research material.

[edit: Windows Movie Maker v2.1 is included with Service Pack 2.]