Monthly Archives: September 2018

Copy-Item Container parameter

The Copy-Item Container parameter controls whether the folder structure is also copied. Lets start with the source material – a folder C:\test with a bunch of files. A destination folder C:\D1 also exists PS>  Copy-Item -Path c:\test\* -Destination C:\D1 copies … Continue reading

Posted in Powershell | 1 Comment

-like oddity

Recently saw a question asking why this code worked PS>  $a = ‘aa’ PS>  $b = ‘a’ PS>  $a -like “*$b*” True PS>  Remove-Variable -Name b PS>  $a -like “*$b*” True Set 2 variables and compare using wildcards. The comparison … Continue reading

Posted in Powershell | Leave a comment

Comparing strings and integers

Saw an interesting problem involving the comparison of 2 numbers. In reality its was comparing strings and integers. The starting point was a CSV file but as I showed last time you can create a CSV in memory PS> $file … Continue reading

Posted in Powershell | Leave a comment

CSV cmdlets

I was reading something and when ConvertFrom-CSV was mentioned it made me pause and think about what that cmdlet actually did. This is a quick explanation of the CSV cmdlets. Export-CSV was available in PowerShell v1. You use it to … Continue reading

Posted in Powershell | Leave a comment

PowerShell copy file

An article I wrote for searchwindowsserver on PowerShell file copy was published recently. The article is available at

Posted in Powershell | 1 Comment

Determining the PowerShell host

The PowerShell ecosystem is more diverse than it used to be which makes determining the PowerShell host a bit more difficult. The variable $host, and its Name property, is a good starting point. PS>  $host.Name ConsoleHost You get ConSoleHost if … Continue reading

Posted in Powershell | 1 Comment

Splitting paths

PowerShell has the Split-Path cmdlet that provides the leaf and parent of a path. But what if you’re splitting paths and need one or paths at a higher level. Consider the path PS> $path = ‘C:\Scripts\HyperV\Admin\Optimize-VMDisks.ps1’ Its just an arbitrary … Continue reading

Posted in File system, Powershell | Leave a comment

PowerShell v6.1

PowerShell v6.1 was released last week – there’s no big ticket items like v6.0 but a lot of bug fixes and minor improvements. You can download from and find the release notes at

Posted in PowerShell v6 | 2 Comments

Get-Date –DisplayHint

On the surface Get-Date is a simple cmdlet that’s been around since PowerShell v1. However, it has some interesting quirks. In this post I’ll show how Get-Date  –DisplayHint works. By default Get-Date returns the data and time PS>  Get-Date 13 … Continue reading

Posted in Powershell | Leave a comment

PowerShell new line

A PowerShell new line can be generated using `n. It’s one of a series of special characters recognised by PowerShell. The full list of Windows PowerShell v5.1 special characters is: `0    Null `a    Alert `b    Backspace `f    Form feed `n    … Continue reading

Posted in Powershell, PowerShell v5, PowerShell v6 | Leave a comment