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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.