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


April 2008

PowerShell 101, Lesson 3

How to use PowerShell's operators and wildcards
RSS
Subscribe to Windows IT Pro | See More Systems Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!
SideBar    How to Find Out a Cmdlet's Properties

Arithmetic Operators
PowerShell supports the use of arithmetic operators to perform mathematical calculations. Table 4 describes the operators and provides basic examples. In addition to using the operators for mathematical calculations, you can use some of the operators other ways. For example, you can use the + operator to concatenate string values:

“Use + to add two” +
  “ “ + “strings together.”

Figure 6 shows the results of concatenating these two values. This figure also shows the results for the statement:

 “abc” * 4

In this case, the * operator is used to multiply a string value four times. As a result, four copies of the value are returned, and those values are concatenated into one string.

My arithmetic-operator examples are very basic. As you work through the lessons, you’ll see more complex examples of how these operators can be used. This section is meant only to introduce you to the arithmetic operators so that you can begin to use them. To learn more about these types of operators, see the about_arithmetic_operators Help file.

Moving Forward
In this lesson, you learned that PowerShell supports a number of operators that let you create expressions and perform calculations. However, this lesson doesn’t cover all operators. For example, PowerShell also supports bitwise operators that perform binary operations and assignment operators that assign values to variables. I’ll be covering many of these operators as we progress through the lessons. In the meantime, refer to the Power-Shell Help files to learn more about the available operators.

End of Article

   Previous  1  2  [3]  Next  


Reader Comments
I'm not sure what to make of this...

Figure 5 is supposed to return all non-Microsoft processes.

I know that the CSRSS process was purchased from Citrix a few years ago and probably not recoded by Microsoft, but why in the world would the System and WINLOGON processes be listed as non-Microsoft?

maddmike April 17, 2008 (Article Rating: )


Very good articles

crjo April 22, 2008 (Article Rating: )


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 To read the previous "PowerShell 101" lessons, go to
"PowerShell 101, Lesson 1"

"PowerShell 101, Lesson 2"


For more information about how to use the Get-Member cmdlet
"What Can I Do With Windows PowerShell? Using the Get-Member Cmdlet"

"Get-Member"


For more information about using PowerShell operators
"Windows PowerShell Constructs"

"What Can I Do With Windows PowerShell? Using the Where-Object Cmdlet"


If you're beyond the basics, check out
"PowerShell Queries for Failed Services on Remote Machines"

"PowerShell One-Liners for Accessing WMI"


Top Viewed ArticlesView all articles
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 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Understanding File-Size Limits on NTFS and FAT

A general confusion about files sizes on FAT seems to stem from FAT32's file-size limit of 4GB and partition-size limit of 2TB. ...


Related Articles PowerShell Script Lets You Check Patches' Status

How to Get Information About Installed Applications Without Using WMI

PowerShell Pointers

Quest Freeware Product Puts a Familiar, GUI Face on PowerShell

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

Related Events WinConnections and Microsoft® Exchange Connections

Deep Dive into Windows Server 2008 R2 presented by John Savill

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting 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