Utilizing an Operator

One of the nice things you can do is use greater than and less than operators in your evaluation clause. What is so great about greater than? It makes working with alphabetic characters and numeric characters easy. If you work on a server that hosts home directories for users (which are often named after their user names), you can easily produce a list of all home directories from the letters D through Z by using the > D operation. Keep in mind that D$ is greater than D, and if you really want shares that begin with the letter E, then you could say greater than or equal to E. This command would look like >='E'.

ListGreaterThanShares.ps1

$strComputer = "."
$wmiNS = "root\cimv2" $wmiQuery = "Select name from win32_Share where ...

Get Microsoft® Windows PowerShell™ Step By Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.