Category Archive: Tips of the week

Apr 02

Powershell Tips of the week #4 – Get-ChildItem – Only show directories

Here’s quick tip on how to make Get-ChildItem only return directories. With Powershell v3, there is a new parameter that allow you to only get directories: Get-ChildItem C:\ -directory Result: Directory: C:\ Mode                LastWriteTime     Length Name —-                ————-   …

Continue reading »

Mar 25

Powershell Tips of the week #3 – Find parent folder

How to find the parent folder of a path that is stored in a variable For the purpose of the example I will manually add a path to a variable. $VarA = "\\\dfs\files\dan.fortier\" The parent folder of this path is “\\\dfs\files” but lets find it with powershell using the Get-Item cmdlet. $ParentFolder = (Get-Item $VarA).parent.FullName …

Continue reading »

Mar 19

Powershell Tips of the week #2 – Measure-Command

In today’s post I will talk about the Measure-Command function in Powershell. This function will tell you exactly how much time it took to run a cmdlet or a script block. The result will be displayed like this: Days              : 0 Hours             : …

Continue reading »

Mar 14

Powershell Tips of the week #1 – Cmdlet Start-Transcript

This week I will show you how to use the Start-Transcript cmdlet. Start-Transcript will allow you to record your powershell session in a text file. The transcript includes all command that the user types and all output that appears on the console. Here is some example on how to use Start-Transcript: This command starts a …

Continue reading »