Category: 2. PowerShell Cmdlet Advance

  • PowerShell Where-Object

    The Where-Object in PowerShell selects the objects from a collection based on their property values. With the Starting of PowerShell version 3.0, you can construct the Where-Object cmdlet in the following two different ways: Syntax Parameters Following are the parameters used in this cmdlet: -Property This parameter is used to specify the name of an object property. It is optional and…

  • PowerShell Sort-object

    The sort-object is the cmdlet of a PowerShell, which sorts the objects in an order based on the property values. We can sort the objects by single or multiple properties. The various properties use the hash tables to sort the objects in ascending or descending order. Syntax Parameters -Stable This parameter was introduced in PowerShell version 6.2.0. The…

  • PowerShell ForEach-Object

    The ForEach-Object in PowerShell executes a block of statements against each item in a collection of input objects. These objects are passed through the pipeline or specified by using the -InputObject parameter. With the Starting of PowerShell version 3.0, following are the two different ways for constructing the ForEach-Object command: Syntax Parameters Following are the different parameters used in the ForEach-Object cmdlet: -MemberName…

  • PowerShell Test-Path

    The Test-Path cmdlet in PowerShell returns $true if all the elements of a file or directory path exist, otherwise $false. It can also tell whether the file was updated after or before the particular date. It determines whether the syntax of a path is valid or not. Syntax Parameters Following are the parameters used in the Test-Path…

  • PowerShell Start-Process

    The Start-Process cmdlet in PowerShell starts one or more processes on the local computer. The saps and start are the two aliases for this cmdlet. Syntax Parameters We can use the following parameters of Start-Process cmdlet to specify the options, such as starting a process in new window, loading a user profile, or using the alternate credentials. -FilePath The…

  • PowerShell Get-Help

    The PowerShell Get-Help cmdlet is used to display information about the PowerShell commands and concepts. It displays the information, including functions, providers, workflows, scripts, and aliases of cmdlets. To get help for a PowerShell cmdlet, type the Get-Help followed by the name of a cmdlet, such as: Get-Help Set-Item. We can also get help for a PowerShell provider,…

  • PowerShell Invoke-Command

    The Invoke-Command cmdlet in PowerShell executes commands on local and remote computers and returns the output with the errors from the command. We can also use this cmdlet on the local computers to the script blocks as a command. Syntax Parameters -ScriptBlock This parameter is required, and it specifies the command to execute. When we create a…

  • PowerShell Get-Command

    The PowerShell Get-Command cmdlet is used to get all the commands which are installed on the computer system. This cmdlet includes functions, other cmdlets, aliases, filters, scripts, and applications. We can get only those commands which have been imported into the current session by using the -ListImported parameter. With the starting of Windows PowerShell 5.0, this cmdlet…

  • PowerShell Write-Host

    The PowerShell Write-Host cmdlet is used to write the customized output to a host. We can specify the text color by using the -foreground parameter, and by using the -background parameter, we can specify the background color. Syntax Parameters -Object The -Object parameter is used to display the objects in the host. -NoNewline The -NoNewline parameter specifies…

  • PowerShell Out-File

    The Out-File cmdlet in PowerShell sends the output to a specific file. When you need to use its parameters, use this cmdlet instead of redirection operator (>). Syntax Parameters Followings are the parameters used in this cmdlet: -FilePath and -LiteralPath Both the parameters are used to specify the path to the file in the command. -Encoding This…