PowerShell

PowerShell Introduction

By: Stephen Patrick | 07 Jul 2016 | Category: PowerShell Introduction

PowerShell Introduction

Windows PowerShell provides a .Net environment that provides a powerful command line shell, and a scripting environment for the windows platform. PowerShell is useful for a number of tasks, including system administration. Windows PowerShell provides a superset of the functionality provided by the CMD.exe DOS like command line environment provided by Windows. PowerShell can be used as interactive command line shell, or as a scripting language.

Read More

PowerShell Cmdlet

By: Stephen Patrick | 08 Jul 2016 | Category: PowerShell Introduction

PowerShell Cmdlet

You can think of a cmdlet as being similar to a shell command. A cmdlet performs a task. PowerShell comes with a number of cmdlets that follow a particular naming convention. They follow a Verb-Noun naming convention e.g. Get-Process, Get-ChildItem, Get-Command etc. The PowerShell interactive command line shell and integrated development environment ISE provide autocomplete on command names.

Read More

PowerShell Pipeline

By: Stephen Patrick | 08 Jul 2016 | Category: PowerShell Introduction

PowerShell Pipeline

The PowerShell pipeline facilitates passing the output of a command as input to another. Pipelines are a common mechanism for joining commands; for example the Linux shell provides this feature. However, the PowerShell Pipeline is more advanced. Other pipeline implementations work primarily with text, while the PowerShell pipeline operates on .Net objects.

Read More

PowerShell Providers

By: Stephen Patrick | 08 Jul 2016 | Category: PowerShell Introduction

PowerShell Providers

PowerShell providers abstract different resources in order to provide a common unified interface. Providers enable you to work with different resources as you would when working with the FileSystem. We can list the installed providers that are currently active on the system using the Get-PSDrive Cmdlet.

Read More

PowerShell Read File Contents

By: Stephen Patrick | 10 Jul 2016 | Category: PowerShell File Processing

PowerShell Read File Contents

PowerShell offers a number of cmdlets for working with files. Sometimes we may need to retrieve the contents of file, to display it, or process it. PowerShell provides a number of different ways to access the contents of a file. Let’s say we have a file called text.txt in the current directory. The file contains the following:

Read More

PowerShell Search File For Pattern

By: Stephen Patrick | 10 Jul 2016 | Category: PowerShell File Processing

PowerShell Search File For Pattern

PowerShell provides functionality to search the contents of one or more files for a pattern. The Select-String cmdlet enables us to achieve this goal.

Read More

PowerShell Searching With Regular Expressions

By: Stephen Patrick | 10 Jul 2016 | Category: PowerShell File Processing

PowerShell Searching With Regular Expressions

Regular expressions provide a powerful mechanism to search a file for text that has a particular pattern. We can use a regular expression to define a particular pattern. For example, we can define a regular expression to match a phone number, email, Uniform Resource Locator (URL) etc. We can define a regular expression to match a piece of text.

Read More

PowerShell: Search And Replace

By: Stephen Patrick | 10 Jul 2016 | Category: PowerShell File Processing

PowerShell: Search And Replace

We can use PowerShell to search for text and replace it in one or more files. We can use the Set-Content and the replace operator to achieve this. Let’s take a look at an example of replacing line numbers from a file with PowerShell.

Read More

PowerShell: Creating Files

By: Stephen Patrick | 13 Jul 2016 | Category: PowerShell File Processing

PowerShell: Creating Files

Sometimes we find the need to create files. We can create files with PowerShell. There are a number of different ways to create a file. We will look at some of the mechanisms here.

Read More

PowerShell: File Comparison

By: Stephen Patrick | 19 Jul 2016 | Category: PowerShell File Processing

PowerShell: File Comparison

A very common task is to compare two files for differences. We may perform this task as part of a post install verification process. PowerShell provides a couple of Cmdlets that aid with this activity.

Read More

PowerShell: Find Files Modified After Date

By: Stephen Patrick | 27 Jul 2016 | Category: PowerShell File Processing

PowerShell: Find Files Modified After Date

We can use PowerShell to find files modified after a certain date. This task can be useful to find recently modified files on a system. We can use the Get-ChildItem cmdlet to perform this task. The Get-ChildItem CmdLet provides the Recurse parameter which allows us to search in child directories.

Read More

PowerShell: Monitor Files For Changes

By: Stephen Patrick | 28 Jul 2016 | Category: PowerShell File Processing

PowerShell: Monitor Files For Changes

We can use PowerShell to monitor files for changes. The Get-Content Cmdlet provides the Wait parameter. The wait parameter will monitor the end of a file for any changes. This task can be useful in a number of situations such as monitoring a log file for changes.

Read More

Popular Articles