Working with Objects in PowerShell

Introduction: An object is an instance of type, many cmdlets are available to get details of an object, create new or update an existing object. In PowerShell, an object can be created either using type of .Net Framework class or with ProgID of a COM object which holds properties and methods New-Object cmdlet: This cmdlet... Continue Reading →

Strings in PowerShell

Introduction: Dealing with strings is one of the most common operations in any scripting language. PowerShell supports lots of built-in functions for string manipulation which are already available form System.String class in .Net Framework. Additionally, there are more operations that can directly performed on string type. Let's see those with some examples: #Example - 1... Continue Reading →

Switch Statement in PowerShell

Introduction: The switch statement checks for multiple case value against a input variable, once a case matches against the input variable then code block in that particular case is executed. Let's see various switch statements examples as below. #Copy, Paste and run below examples in PowerShell to see the output. #Example - 1 : Simple... Continue Reading →

Loops in PowerShell

Introduction: The loops are part of any scripting language and PowerShell provides complete support for loops. Let's see them with some examples Foreach: This loop iterates through a collection and each value can be used further or just print to see the output. #Example 1 - Prints the value $CountryNames = @('India', 'UK', 'US', 'JAPAN',... Continue Reading →

Operators in PowerShell

Introduction: Windows PowerShell supports all operators which are supported by any programming or scripting language. Operators are responsible for manipulating the values to get the desired output. Types of Operators: Powershell supports an exhaustive list of operators and, frequently used operators are listed but are not limited. Arithmetic Operators Assignment Operators Comparison Operators Logical Operators... Continue Reading →

Variables in PowerShell

Introduction: Windows PowerShell’s variables hold any type of values while executing the commands. The variables store the result from a command, function, and expression. Variables are declared using $ sign before the variable name. Ex. $age, $date_of_birth. How to Define PowerShell Variables: PowerShell variables can be defined as below Define and assign value: $age =... Continue Reading →

PowerShell Introduction

Introduction: WindowsPowerShell is an enormously accomplished command line tool. PowerShell is being used to automate system administration activities, for example application deployment, maintenance, configuration and management of Windows features and seamlessly use with batch files. Windows PowerShell is developed on the top of the .Net Framework which helps to invoke the .Net class objects and... Continue Reading →

Up ↑