Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


May 21, 2008

Windows PowerShell Range Operator Tricks

Take aim with the range operator to generate complex sequences of numbers to help automate administrative tasks
RSS
View this exclusive article with VIP access -- click here to join |
See More Task Automation Articles Here | Reprints | Or sign up for our VIP Monthly Pass!
SideBar    A Common Misconception About PowerShell's kb, mb, and gb Operators

If you work as a consultant for small-to-midsized businesses (SMBs), you know that assessing client networks is a perennial task. In some cases, you might have sources such as Active Directory (AD) for identifying some of the computers on a LAN, but the tried-and-true method for discovering everything that's out there is frequently just testing the addresses on the entire local IP network. This method won't find machines that are turned off or currently away from the network, but it's a handy foundation for live data collection—and, as a bonus, also discovers network appliances that you might not know about. But it's not acceptable to have someone manually enter all the valid addresses for a typical network—typing all those numbers is laborious and error-prone. This is where knowing a few easy tricks with Windows PowerShell will help you out.

PowerShell's range operator (..), combined with pipeline processing, lets you run a task hundreds of times just as easily as running it once. This feature is handy for network administration tasks involving many computers. To show you what I mean, I'm going to demonstrate how to quickly generate an entire family of IP addresses for computers, letting you easily perform data-collection tasks that would otherwise take a lot of effort. . . .


Already a VIP member?
Please log on to view the full article

Why become a VIP member?

VIP-only online access
VIP CD delivered twice a year: offline access to the entire Windows IT Pro article library
Monthly issue of your choice of Windows IT Pro or SQL Server Magazine

Subscribe Now
Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Learning Path For information about getting started using PowerShell:
"Dig Out by Digging Into PowerShell"

"PowerShell 101, Lesson 1"

"Steps for Getting Started with PowerShell"

"Essential Windows PowerShell Commands"

"PowerShell Empowerment"


For more information about PowerShell operators and comparisons:
"PowerShell 101, Lesson 3"


For more information about PowerShell pipelining:
"PowerShell 101, Lesson 2"


For other simple PowerShell tricks, see the PowerShell One-Liners series from Robert Sheldon:
"PowerShell One-Liners for Managing the File System"

"PowerShell One-Liners for Managing Events"

"PowerShell One-Liners for Accessing WMI"


MICROSOFT RESOURCES
"Windows PowerShell Tip: Using the Range Operator in Wildcard Queries"

"Windows PowerShell Tip: Accessing Values in an Array"

"Piping and the Pipeline in Windows PowerShell"


Top Viewed ArticlesView all articles
2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...


Related Articles PowerShell 101, Lesson 2

PowerShell Empowerment

PowerShell 101, Lesson 1

Dig Out by Digging Into PowerShell

Task Automation Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events Cutting Costs with Client Management

PowerShell 201 - eLearning Series with Paul Robichaux

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement