Tuesday, May 30, 2017

Coming to Grips with Microsoft Powershell

WARNING: 
The following article contains segments of sarcasm and defeatism. It is simple venting and not helpful in any way and should be ignored by the general population.

PowerShell from a Beginner's Perspective


So, with all the downtime I've had lately (being unemployed) I decided to take some online classes to answer some of the questions I've had about many of the products I use, and to alleviate the boredom... Okay, so it's mostly to alleviate the boredom, but it never hurts to learn a new skill.

Since my unemployment wages aren't exactly stellar, I really don't have the resources to pay for an actual class with an instructor and credit. Luckily, most of the courses in the Microsoft Virtual Academy are free. I've used PowerShell in the past, but never really understood what it actually was, mistaking it for a fancy command line terminal. It was with great enthusiasm that I found a PowerShell course for beginners on the MVA site. That's where the trouble began...

I'm no stranger to DOS, and its derivative, the Windows command line. I've used various Linux builds in the past, but I would be lying if I said I really understood the whole terminal system, which is its core. I've also used Unix once or twice, but only to type in the commands that I was told to type in, and never to learn how to use it effectively. I thought I'd bite the bullet and try to learn something productive and useful.

Let's get down to it.


PowerShell is a non-graphical program. It looks like white text on a blue background. There are no buttons to click, and no pictures to look at. It was made (I suspect) to look like a Unix terminal program. It is simply the most boring-looking program you'll use this side of Notepad.

Source.
At first, DOS and Windows Command Line people will think that it's just a fancy and more powerful command line system, and they're kind of right... Let's say (for example) that you want to list a directory in PowerShell. In DOS, you would type the command "dir" to bring up a list of files and programs in the current directory. In PowerShell, you could also type "dir" to do the exact same thing.

Well, not exactly the same thing... You see, PowerShell is quite a different animal on the back-end. Unlike DOS (which is essentially just a text parser), PowerShell is running these programs and commands in real-time. The reason you can type DOS commands and get the same results is because they use an "alias" system to assign common command line instructions from DOS, Linux, and Unix to link to similar commands in PowerShell.

For a list of aliases in your PowerShell program, type "alias" and hit enter.

While these aliases do a pretty good job of letting you do basic stuff with little experience, the problem is that some of the more involved parameters of the commands are absent. For example, typing "dir /p", which in DOS would display the directory contents one page at a time instead of all at once, will not work and return an error message.

The 10 (thousand) Command-lets


PowerShell uses a system of commands known as cmdlets (pronounced "command-lets") to perform operations. They are put together in a verb-noun syntax. If you wanted to get a list of the cmdlets available to you, for example, you would type "Get-Command" and PowerShell will inundate you with far too many commands to register in your feeble meat-brain. Each of these commands will also have a number of parameters (some of which are required) that don't show up in the list, making the program all but useless.

"But it's okay," the PowerShell developers scream, "Because we have a robust help system!" And they're not lying: There IS a robust help system. How does it work? It's simple: 

All you have to do is know exactly which of the hundreds of cmdlets you need ahead of time, and simply type "help (cmdlet nem here)" for a huge page of information (all poorly-formatted text) that tells you way too much information about the command that you want, thus confusing you further.

(Editor's note: You also have to download the help files using a special command. I forgot what it was. Good luck finding it!)

You know what's even better? Depending on what system you're on and what PowerShell packages they've installed, you could have THOUSANDS of cmdlets to dig through. Bon appetit.

So basically, the procedure is this: Go online via your web browser, spend an hour looking for the right command for what you want to do, type it in, and then wait for the error message to pop up.

What? Errors?


Yes, because every cmdlet has parameters that you need to set to use it effectively. Except that the syntax for those parameters (it seems) varies from cmdlet to cmdlet with no discernible pattern. Unless it's a command you've been using a long time, you're going to have to look it up, and then choose the correct syntax, which can be troublesome because you must type everything letter by letter, it just begs for errors. And when you get an error, you'll scratch your head because the error message it gives you sometimes makes no sense at all. 

Who is "Kerberos?"

The POWER in "PowerShell"


The real power in PowerShell is its ability to pipeline one cmdlet into another using the "|" character (the straight line above the backslash key on your keyboard). It works like this: You type in a cmdlet and its parameters, then type the pipeline character (|), then type another cmdlet and its parameters. This allows any cmdlet to the right of the pipe to send its information into the cmdlet to the left, then wait for the error message! It's that simple! It's like having the ability to not run one cmdlet, but now you cannot run two or more at a time! That's powerful!

And you can save these cmdlets as a special text file that allows you to run large piped commands as a script! And that script can include C# elements, but the PowerShell text parser can't match the syntax, so be prepared to learn how to do THAT all over again!

Networking Blues


So, this is the conundrum: You want to use PowerShell to manage your LAN and your servers, but you need to set up and manage your LAN and your servers before you can use PowerShell. 

Oh sure, the guys in the instructional videos have no problem doing it right the first time every time, but they never show you the other computer or how to set it up. They're sending commands into the ether, and getting back data that really isn't all that helpful.

But me? I can't even connect to my Dad's PC. Ideally, I'd like to be able to monitor his processes and issue updates to his computer to keep it running when I'm not at home, but even with his computer on the same network I can't seem to connect to the damn thing, and no PowerShell tutorial I've found has been able to explain why that is. It's extremely frustrating. But that's okay -- even if I knew HOW to connect to his computer I wouldn't have the first clue as to how to do any of that management remotely, and the videos aren't really being that helpful.

"For Beginners."


I am more than halfway through the first video course on the MVA, and I am hopelessly lost. Ever since they began networking to other machines in the videos I haven't been able to keep up (because I can't follow along, because networking doesn't seem to work), and re-watching the videos has not helped. It's like they're only giving you half the information. At this point, I am so disillusioned and bitter about the whole thing that I'm not sure I want to keep going. There's a whole second part to the course that I haven't even started, because nothing they are saying at this point makes even a little bit of sense.

Let's face it, if you're a beginner you're probably going to want to steer clear of PowerShell. If you're someone who's elbows-deep in server maintenance eight hours a day, you're probably going to want to learn it at some point, and to you I say, "good luck," because you'll need it.


Thursday, May 4, 2017

6 Job Scam 'Tells' Every Job Seeker Should Know

I was deep into my job search, when I received and email from my freelance account on Upwork.com:

“We read your resume, and think that you would be a good fit for our full-time position.”

Naturally, I was curious, and replied via email. The person (who went by the name, “Nelson George”) claimed to be a part of a data entry firm owned by a biotech company (which I will not name here – but it’s not relevant, it could have been any large company), and provided me with a link to the company. I quickly researched it, and found that they are indeed a legitimate business, and a rather large one at that.


1) Suspicious name and email address


Still something seemed off. For one thing, “Nelson George” wasn’t using a company email address. Companies as large as the one referenced tend to have corporate email servers, and their employees will almost always have a company email address (especially when contacting clients and possible employees).

2) Too good to be true


Secondly, my going rate on Upwork.com is $18 an hour, and the company was offering $20 an hour during training with an increase to $40 an hour afterward. Now, I’m not one to look a gift horse in the mouth, but I’ve never heard of a data entry job (and yes, I’ve had several) offering that kind of money, especially when the other party is asking for so little. I decided to see how far the rabbit hole went.

3) Method of contact matters


“Nelson George” suggested that we have a chat via Google Hangouts rather than a simple phone call (yes, the company I was given a link to has its own contact page with its own chat script, so red flag number 3). We initiated the chat, and he asked me why I’d be the best person for the position. I gave him info that could easily be found on the internet, being very careful not to give him too much, just to see what the scam could be.

4) Purchasing perils


After giving him my carefully scripted background info, he said (surprise!) that I would be perfect for the job, but I would require software from one of their vendors to get started. This is where I knew something was definitely up. I carefully explained that I didn’t have the money to purchase said software, and he stated that the company would FedEx me a check to deposit that would allow me to buy the software and keep whatever was left over.

Now let me ask you, the reader: Does that sound like something any company you’ve ever worked for would do? At this point I knew it was a scam, but I played along for a while. I would not give him any banking information, passwords, or my social security number (it was only a matter of time until he asked).

5) Awful acceptance letters


“Nelson George” e-mailed me an acceptance offer letter that he wanted me to sign and send back.

NOTE: Before opening anything sent to you by a potential employer, scan the document for viruses. Also, if it’s an MS Office document, make sure that your program macros are turned off by default or it could open a viral script upon opening.

The “letter” was a Microsoft Word document with about a hundred misspellings, grammatical errors, letter case mistakes, and other errors PER PAGE. Plus, take a look here:

That font that my name’s written in? That’s “Algerian.” Now, I don’t know for certain how many pages a real large-scale business produces annually, but I’m damn sure that none of them use “Algerian” as a font on a serious legally-binding document. In fact, the document used like five different fonts (you can see four of them in the example above).

6) Unaccountable accounting


Still, I filled out the letter (again, not using any info that isn’t out there already) and sent it back to them. That’s when the “accounting” questions began.

“What bank do you use? Do you have a cell phone banking app? What’s your bank’s limits for daily deposits?”

The jig is up


I started to get a picture of what the scam actually was, but for confirmation at this point I asked “Nelson George” what the scam was.

“Scam? What scam?” he asked in turn.
“Well, you’re offering me more than what I asked for, your letter has more than a few errors in it (including the capitalization on your surname), you’re not using a company email address, and I can’t find you listed as the head of HR on any of (the company’s) online materials.” I replied.

The conversation was disconnected at that point, and “Nelson George” dropped off the face of the planet (possibly forever).

What the scam was


What I think these companies do is get you to print out a bum check. Of course, when depositing a check to the bank (even using an app) it takes time to clear and there are limits to how much you can withdraw.

Here’s where I have diverging hypothesis on the middle of the scam. They might have you purchase the software from their “vendors” (which is in fact the person acting as “Nelson George”), effectively stealing the funds before the check bounces. They might also be having you purchase the software from a legitimate source and having you give them the licenses so that they can sell those for later profit. They may even be able to parlay a problem with the check into you giving them money or your bank account information directly.

Either way, the scam ends the same way: You take money out with a fake check, they get a piece of you, and when the bank wants its money back you will be on the hook.

Be on the lookout for these things. Putting your resume and contact information online is essential to job seekers, but as with anything once the genie is out of the bottle it’s nearly impossible to put it back in.

Helpful tips:

  • Don’t assume that just because someone gives you a link to a legitimate site that they represent that business in any way. Research the business, and call them directly if you have suspicions.
  • The old adage, “If something seems too good to be true, it probably is,” is a good adage to live by. Approach these ‘opportunities’ with caution. Know what you’re worth, and know what a typical salary for the job encompasses.
  • Never give your private information to anyone that you have no credentials for. A name and an email address is not enough.
  • If the company wants you to buy something, or money is supposed to change hands, exercise your better judgement: Legitimate businesses typically have the structures in place to get you the materials you need without having to give you the capacity to purchase essential items.