IT tutorials
 
Technology
 

PowerShell for Microsoft SharePoint 2010 : Logical Operators

12/10/2013 2:17:21 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

The logical operators are used to combine expressions, allowing you to check multiple conditions in one statement. Expressions on the left and the right side of any of these operators are evaluated (if necessary), converted to Boolean values of True or False, and then the combination of those values is returned, following the rules of formal logic. Table 1 lists the logical operators supported by Windows PowerShell.

Table 1. Windows PowerShell Logical Operators
OperatorDescription
-andReturns True when both left and right hand side expressions evaluate to true
-orReturns True when an expression on at least one side evaluates to true
-xorReturns True when left and right side expressions have opposite values (one is True and the other is False)
-notChanges the Boolean value of the expression that follows it for the opposite
!Same as -not

With the -and operator, you can evaluate multiple expressions. If all the expressions evaluate to true, the Boolean value of True is returned.

PS > (1 -eq 1) -and (2 -eq 2)
True
PS > (1 -eq 1) -and (2 -eq 3)
False

The first example returns True, since both expressions evaluate to True. The second example returns False, since the last expression does not evaluate to true.

The –or operator returns True if one or more expressions evaluate to true.

PS > (1 -eq 1) -or (2 -eq 2)
True
PS > (1 -eq 1) -or (2 -eq 3)
True

The -xor operator returns True only if one of the expressions evaluates to true.

PS > (1 -eq 1) -xor (2 -eq 2)
False
PS > (1 -eq 1) -xor (2 -eq 3)
True

The -not operator returns True if the right value evaluates to false.

PS > -not (1 -eq 1)
False
PS > -not (1 -eq 2)
True
PS > !(1 -eq 2)
True
 
Others
 
- PowerShell for Microsoft SharePoint 2010 : Comparison Operators
- PowerShell for Microsoft SharePoint 2010 : Assignment Operators
- PowerShell for Microsoft SharePoint 2010 : Arithmetic Operators
- Microsoft Systems Management Server 2003 : Updating Collections (part 3) - Collection Evaluator Update Process Flow, Status Messages
- Microsoft Systems Management Server 2003 : Updating Collections (part 2) - Deleting a Collection
- Microsoft Systems Management Server 2003 : Updating Collections (part 1) - Forcing an Update
- Implementing Exchange Server 2010 Security : Configuring Standard Permissions for Exchange Server (part 3) - Assigning Advanced Exchange Server Permissions
- Implementing Exchange Server 2010 Security : Configuring Standard Permissions for Exchange Server (part 2) - Assigning Standard Exchange Management Permissions
- Implementing Exchange Server 2010 Security : Configuring Standard Permissions for Exchange Server (part 1) - Understanding the Exchange Management Groups
- LINQ to SharePoint and SPMetal : Combining LINQ to SharePoint and LINQ to Objects
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us