• 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-676c0e74dd917617368793/] [crayon-676c0e74dd91c992731996/] 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-676c0e74dda59090361246/] 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-676c0e74ddb8f983312889/] 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-676c0e74ddd49521592258/] [crayon-676c0e74ddd4c710525402/] 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 […]

  • Count files in folder in PowerShell
    01 January

    PowerShell – Count Files in Folders

    Count Files in Folders in PowerShell We can use the Measure-Object cmdlet in different ways to meet our project requirements. However, before moving forward, it is essential to know how many files and folders we have on the different paths that we will use in this article. E:\Test contains three folders (FolderA, FolderB and FolderC) […]