ps1

Using Default Parameters

In PowerShell 3.0, an option was added to define default values for arbitrary cmdlet parameters. This line, for example, would set the default value...

read more

Finding Working Days

To find all working days in a given month, here is a neat little one-liner: $month = 7 1..31 | ForEach-Object { Get-Date -Day $_ -Month $month } |...

read more

Speeding Up Background Jobs

Background jobs can be a great thing to speed up scripts because they can do things in parallel. However, background jobs only work well if the code...

read more

Using Nested Hash Tables

Nested hash tables can be a great alternative to multidimensional arrays. They can be used to store data sets in an easy-to-manage way. Have a look:...

read more

Speeding Up Arrays

When you assign new items to an array often, you may experience a performance problem. Here is a sample that illustrates how you should not do it:...

read more

Fun with Path Names

You can use the -split operator to easily split a path in its components. The result is always an array. Simply use comparison operators to exclude...

read more

Using Profile Scripts

You probably know that PowerShell supports profile scripts. Simply make sure the file found in $profile exists. It's a plain script that gets...

read more

Bulk File Renaming

Let's assume you have a bunch of scripts (or pictures or log files or whatever) in a folder, and you'd like to rename all files. The new file name...

read more
1 70 71 72 73 74 128