Powershell and Mysql featuring the null byte (x00)

For those of you who follow our blog, Brett does a lot of articles about PowerShell and how great it is. So the other day when I need to do a mysql dump of some data on a Windows 2008 server, I fired it up. The deep blue background touched my inner California beach bum, and the verbose bright red error messages made my inner programmer smile.

“This is pretty neat,” I thought. “Maybe Windows has finally made something to compete with Unix’s shell in a real and meaningful way.”

The dump finished and immediately my Common Sense began tingling…
Continue reading

Remote computing and PowerShell 2.0 part 1 – Getting started

It’s a pretty routine event for me to be remotely logged into more then one Windows server through Remote Desktop, or even occasionally sending a command from CMD to a remote server. PowerShell has not been left out of the game, when it comes to remote computing.  If you have a Windows 7, and a Windows 2008 machine, then everything you need has likely already been installed. In this blog I will discuss the steps needed to make and accept connections from PowerShell, and discuss running a single command on a remote computer. If not then you will need to download and install the Windows Management Framework Core package. You can find it here: support.microsoft.com/kb/968930

Continue reading

Powershell the switch statement pt 2.

The string value specified in the switch statement’s script block has to exactly match a condition for that condition to equal true. Despite it being unnecessary for exact matches, this would be the same as using the -exact option in a switch statement. There are other options available for use such as -wildcard which lets you use wildcards, and -regex which uses regular expressions. lets look at an example;

Continue reading

PowerShell Tutorial the switch statement part 1.

PowerShell’s switch statement is similar to an if statement though easier to implement when you want to evaluate numerous conditions. You can use the switch statement to automate tasks such as retrieving System event log entries and performing actions based on the type of entry, and or moving and deleting files based on their file names.

Continue reading

Powershell tutorial. The For Statement

This week’s lesson builds on last weeks tutorial but introduces the For statement. The For statement uses a counting loop that processes and continues through a collection as long as the condition equals true. Similar to If statements, the for statement includes a conditional code block and a script block. However you will see that the conditional code block is far more complex.

Continue reading