PowerShell tutorial 5

You will undoubtedly need to use variables in your PowerShell scripts from time to time fortunately PowerShell has you covered. There are many built-in variables you can use to provide such information as the home folder ($pshome) or the current working folder ($pwd). If you would like to see a list of the built in and user defined variables available to the current session type;

Continue reading

Perl on Linux – Greedy Regular Expressions and the Question Marks that Tame Them

In 1986, Larry Wall invented a scripting language to solve the problems of generating reports for system administrators on unix. He called it the Practical Extraction and Reporting Language since that was its function. And it does do that. In a Unix based OS where everything is output in text, Perl has dominated somewhat because it so easy to use but mostly because of its powerful and easily used regular expression capabilities.
Continue reading

PowerShell tutorial part 4

Almost all of your PowerShell statements are going to include string values. Most of the time these strings are simply passed to cmdlets as arguments, but in a few cases, those strings are enclosed in either double or single quotes. The rules that govern when to use single or double quotes are referred to as quoting rules. This tutorial will attempt to explain those rules.

Continue reading

Perl on Linux – Formatting Text and Reports

Surely one of the most annoying things about working in a non-gui environment is convenient formatting. We have all had output that was off due to tabs or new lines or variables that overran their boundaries in the output area, etc. Provisioning for such things can be tedious, time consuming, and highly annoying. Luckily for us, perl provides a text formatting feature that is built in and fairly easy to use.
Continue reading

Perl on Linux – Bitwise Manipulations

Today’s attention is directed at one of the less well known and certainly one of the least understood and used areas of perl. Although direct manipulation of bits is the only thing that a computer really does, programmatic manipulation thereof has been abstracted out for all but the tasks that can only be solved by its use. Still, there are situations and times when it becomes necessary and proper for one bit to dissolve the logical bonds which hold them to the byte and to assume, amongst the operators and variables of the language, an equal station.
Continue reading

Tail command for windows

The other day, one of my tech friends who is more familiar with linux then I, was talking about being unable to tail log files in windows. A command to do so didn’t immediately come to mind so I got to poking around on the inter tubes for a solution. As it turns out the tail command isn’t installed by default with windows but is available for download. The Microsoft downloads site offers the tail command with the Windows 2003 Resource Kit along with many other tools for administrating Active Directory, cleaning memory, raid configuration and lots more. I installed this kit and immediately noticed that when I typed tail /? at the command prompt I got an error. This error was due to windows not knowing where to find that particular command, so I had to add its location to my path. I right clicked my computer and then clicked properties. then I clicked advanced, then I clicked the button labeled “Environment Variables”. In the section labled “user variable for myusername ” I first clicked path and then clicked edit. I already had a variable in my path statement so I simply added the path to the resource kit install directory with this

;%SystemRoot%C:Program FilesWindows Resource KitsTools

then I clicked ok all the way back out, and then tested by typing tail /? which gave me the syntax to use when tailing a file.

Perl on Linux – Anonymous Hashes, Hash References, and Passing Them to Subroutines.

There comes a time in every perl programmers life when they have to master the hash. Anyone who has programmed in Perl for very long has run into problems such as subroutine arguments getting confusing, lagging programs due to hash tables being copied over and over, and searched for a simpler way to maintain and access data. All this and more can be achieved by the simple use of anonymous hash tables and the passing of hash table references to subroutines for processing.
Continue reading

PowerShell tutorial part 2.

This weeks PowerShell tutorial covers how to create pipelines and output management. Powershell pipelines are a series of cmdlets that pass objects from one to another. Each cmdlet generates an object and passes it to the next cmdlet via the pipeline. The receiving cmdlet uses that object as input and generates its own object as output. Connecting pipelines is done by using the pipe character (|).

Continue reading