Category Archives: Best Practices

Filter Left

When writing WMI queries expressions in Windows PowerShell, it is recommended to use WMI filtering, as opposed to getting objects and then filtering with Where-Object. I see expressions like this quite often: get-wmiobject win32_process -computer $c | where {$_.name -eq … Continue reading

Posted in Best Practices, Google Plus, PowerShell, WMI | Tagged , , | Leave a comment

Verbose or Debug?

This morning there was some discussion on Twitter about when to use Write-Verbose and when to use Write-Debug. They both can provide additional information about what your script or function is doing, although you have to write the code. Typically, … Continue reading

Posted in Best Practices, PowerShell v2.0, SAPIEN, Scripting | Tagged , , , , , , | 8 Comments

Filtering Empty Values in PowerShell

I saw this tip today and wanted to leave a comment but couldn’t see how. So I thought I’d post my comments here. This is actually a question I see often and there are better ways to write this kind … Continue reading

Posted in Best Practices, PowerShell, Scripting | Tagged , , , | 20 Comments

ByValue, I Think He’s Got It

Recently I responded to an email from a student seeking clarification about the difference between ByValue and ByProperty when it comes to parameter binding. This is what makes pipelined expressions work in Windows PowerShell. When you look at cmdlet help, … Continue reading

Posted in Best Practices, PowerShell | Tagged , , , , , | 1 Comment

Creating ACL Reports

I saw a tweet this morning that was a PowerShell one-liner for capturing folder permissions to a text file. There’s nothing wrong with it but it’s hard to be truly productive in 140 characters so I thought I would take … Continue reading

Posted in Best Practices, PowerShell v2.0, Scripting | Tagged , , , , , | 5 Comments