• Multiline comment in PowerShell
    05 January

    PowerShell – Multiline Comment

    Using <# #> Tags Use the <# tag at the beginning of comments and the #> tag at the end of comments to create multiline comments in PowerShell scripts. All lines inside the comment block are part of the comments. [crayon-68bbac6bf0e33307022451/] In programming, we use a comment block to provide explanations or details about the […]

  • Call PowerShell Script from another Script
    05 January

    Call PowerShell Script from Another Script

    1. Introduction to the Problem Statement PowerShell, a powerful scripting language and command-line shell, is widely used for automation in Windows environments. A common requirement in PowerShell scripting is to call one script from another, enabling modular programming and reusability of code. Suppose we have two scripts: ChildScript.ps1: This script performs a task and returns […]

  • awk print $2
    05 January

    What is awk print $2

    In this tutorial, we will see about what is meant by awk print $2. awk is interpreted programming language. It is very powerful programming language and used for text processing. Awk stands for the names of its authors “Aho, Weinberger, and Kernighan”. awk print $2 As said before, awk can be used for text processing. […]

  • Check if Service is running in PowerShell
    05 January

    Check if Service is Running in PowerShell

    Using Get-Service Cmdlet Use Get-Service with the Where-Object cmdlet to check if a particular service is running on our local machine. [crayon-68bbac6bf16da819880384/] [crayon-68bbac6bf16dd149150876/] If you need to put if condition, then head over to this section . We used the Get-Service cmdlet to get a list of all services on a local computer; the list […]

  • Run reg file in PowerShell
    05 January

    Run .reg File Using PowerShell

    Using Invoke-Item Cmdlet Use the Invoke-Item cmdlet to run the .reg file using PowerShell. [crayon-68bbac6bf1812040995423/] For the above command, Invoke-Item performed its default action, which means it allowed us to execute a .reg file. We can also use it to run a file, for instance, a script file. When we ran the Invoke-Item cmdlet with […]

  • PowerShell restart Computer
    05 January

    PowerShell – Restart Computer

    Using Restart-Computer cmdlet Use the Restart-Computer cmdlet to restart the local/remote computer. The syntax of this command is given below. [crayon-68bbac6bf1961186025666/] The Restart-Computer command has some parameters that we can use based on our requirements. You can find parameter names and their description below: Parameter Description ComputerName It is used to enter the system’s name […]

  • Get Current Directory in PowerShell
    05 January

    Get Current Directory in PowerShell

    Using Get-Location Cmdlet Use the Get-Location cmdlet to get the path of the current working directory in PowerShell. [crayon-68bbac6bf1b10882139612/] [crayon-68bbac6bf1b13099452316/] As we can see above, our current working directory is C:\Users\DELL, which means we are currently working in the DELL folder within the Users folder on the C drive of the Windows operating system. We […]

  • Check if Variable is null in PowerShell
    04 January

    PowerShell – Check If Variable Is Null

    1. Introduction In PowerShell, checking if a variable is null (or in PowerShell terms, $null) is a fundamental task in scripting, especially when dealing with the output of commands, function returns, or processing user input. For instance, a variable storing data from database might be null if no data is present. In this article, we […]

  • PowerShell get filename for Path
    03 January

    PowerShell – Get Filename from Path

    PowerShell – Get Filename From Specified Path The location of a file on a system can be determined by its path. In PowerShell, there are several ways to get filename from path. Firstly, it’s essential to understand what is in a path before going into depth. What is in a Path? A path indicates the […]