Entries Tagged as 'PowerShell'

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

[Read more →]

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;

[Read more →]

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.

[Read more →]

PowerShell tutorial. The While Statement

Similarly to the for statement, the while statement is another type of loop that parses through a collection. The while statement also includes a conditional code block and a script block and continues for so long as the conditional code block equal true.

[Read more →]

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.

[Read more →]