IT tutorials
 
Technology
 

PowerShell for Microsoft SharePoint 2010 : Assignment Operators

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

Assignment operators are used to assign one or more values to a variable, modify values in a variable, or add values to a variable. Table 1 shows the assignment operators available in Windows PowerShell.

Table 1. Windows PowerShell Assignment Operators
OperatorDescription
=Sets the value of a variable to the specified value
+=Increases the value of a variable by the specified value or appends to the existing value
−=Decreases the value of a variable by the specified value
*=Multiplies the value of a variable by the specified value or appends the specified value to the existing value
/=Divides the value of a variable by the specified value
%=Divides the value of a variable by the specified value and assigns the remainder to the variable
++Increases the value by one
−−Decreases the value by one

The most common assignment operator is the equal operator (=). You can use the equal operator to assign a value to a variable.

PS > $variable = 1
PS > $variable
1

You can also assign the same value to multiple variables.

PS > $variable1 = $variable2 = 3
PS > $variable1
3
PS > $variable2
3

Here are examples of using some of the other assignment operators:

  • To increase the value of a variable by a specific value, use the += operator:

           PS > $variable = "Windows"
    PS > $variable += " "
    PS > $variable += "PowerShell"
    PS > $variable
    Windows PowerShell
  • To decrease a variable with a specific value, use the -= operator:

           PS > $variable = 5
    PS > $variable -= 3
    PS > $variable
    2
  • To multiply a variable with a specific value, use the *= operator:

           PS > $variable = "-"
    PS > $variable *= 8
    PS > $variable
    --------
  • To increase a numeric value by one, use the ++ operator:

           PS > $variable = 1
    PS > $variable ++
    PS > $variable
    2
  • To decrease a numeric value by one, use the -- operator:

           PS > $variable = 0
    PS > $variable --
    PS > $variable
    -1
 
Others
 
- 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
- Windows Server 2008 and Windows Vista : Preferences (part 6) - Network Security
- Windows Server 2008 and Windows Vista : Preferences (part 5) - Hardware Components
 
 
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