Category: Powershell

PowerShell 3.0 -NotIn and -In

New PowerShell 3.0 Comparators -NotIn and -In PowerShell 1.0 not only has comparison operators such as -Match, -Like and -Contains, but also their negative counterparts such as -NotContains.  Here in PowerShell 3 we have two new members of the comparsion operators team: -In and -NotIn. Windows PowerShell -In Topics Example …

PowerShell Invoke-Expression

Introduction to PowerShell’s Invoke-Expression Invoke-Expression is a brilliant PowerShell cmdlet, which mimics us typing instructions into a ‘DOS box’.  A typical scenario is where you are expert with cmd.exe, and now you want to execute the same commands, but using PowerShell.  This is a job for the Invoke family of …

Measure-Object in PowerShell

Measure-Object: Where-Object Versus -Filter On this page we have a real-life task for Measure-Object.  We are going to compare the performance of PowerShell’s -Filter with Where-Object.  In a nutshell, we want to see if it speeds up a script to filter the data stream before piping it into a Where-Object …

Create PowerShell Profile File

Introduction to Windows PowerShell’s Profile Path Old timers can remember configuration files such as AutoExec.bat and Config.sys to control the startup environment, and more modern Microsoft operating systems need boot.ini or bcdedit.  Well, the purpose of this page is to configure the equivalent PowerShell start-up file: Microsoft.PowerShell_profile. PowerShell User Profile …

PowerShell Clear-Eventlog

How to Delete Eventlog Messages Here on this page are PowerShell scripts to assist with house-keeping Windows logs.  The focus is on cleaning these records, but the scripts also show you how PowerShell can first back-up the Windows system logs. PowerShell Clear-Eventlog Topics Preliminary Task: PowerShell Shows Logs Precaution: Backup …