• Compare contents of two folders in PowerShell
    07 March

    Compare Contents of Two Folders in PowerShell

    Comparing Contents of Two Folders in PowerSHell PowerShell is a powerful tool that can help system administrators and IT professionals automate routine tasks, and one of the common tasks is comparing the contents of two folders. This can be useful for identifying differences between two directory versions or finding missing files in a backup. To […]

  • Print Blank Line in PowerShell
    20 February

    Print Blank Line in PowerShell

    Print Blank Line in PowerShell We have two string-type messages that we want to print on the PowerShell console, but in between, we also want to have a blank line to increase the readability. For instance, we want to get results as follows: [crayon-66433e6694684437015263/] To do as demonstrated above, we can use different ways. Let’s […]

  • 14 February

    How to Run ps1 File from PowerShell

    Running from PowerShell Command-Line To run a PowerShell script(.ps1 file) from a PowerShell command line: Launch the PowerShell as an Administrator and wait for the PS> prompt to appear. Navigate to the directory having your PowerShell script file. Type .\ followed by the ScriptFileName.ps1 and hit Enter to execute the script. [crayon-66433e6694cfc962267471/] [crayon-66433e6694d02974809520/] You must […]

  • Set environment variable in PowerShell
    14 February

    Set Environment Variable in PowerShell

    Windows Environmental Variables and Their Scope There are three different scopes for environment variables in Windows. Set the Session Environment Variable Set an Environment Variable for a User Using PowerShell Set the Machine Environment Variable Before moving towards solutions, we must know the environment variables and why we use them. System administrators can access a […]

  • Check if String contains Number in PowerShell
    14 February

    Check if String Contains Number in PowerShell

    Using Regular Expression We use regular expressions whenever we are required to look for specific patterns in the text. The regular expressions, also known as regex, comprise operators, literal characters, and other constructs. PowerShell has various cmdlets and operators that allow us to use regex with them; some of them are given below: Using -match […]

  • Split String into Variables in PowerShell
    14 February

    PowerShell – Split String into Variables

    Using Split() Method Use the Split() method to split the given string into two variables. [crayon-66433e6695d1e708989331/] [crayon-66433e6695d22583801854/] The Split() method is used to split the specified string into two/multiple variables and an array of substrings. In the above example code, the Split() method took two arguments, whitespace as a separator (you can use -, ., […]

  • Compare Arrays in PowerShell
    14 February

    Compare Arrays in PowerShell

    In this post, we will see how to compare Arrays in PowerShell. PowerShell supports arrays with one or more dimensions and zero to many elements in each dimension. Elements inside a dimension are numbered from 0 in ascending integer order. In addition, the array subscript operator [] allows access to any particular element. PowerShell may […]

  • Create temp directory in PowerShell
    14 February

    Create Temp Directory in PowerShell

    Using [System.IO.Path]::GetTempPath() Method with New-Item cmdlet Use the [System.IO.Path]::GetTempPath() with New-Item cmdlet to create a temporary directory in PowerShell. [crayon-66433e6696b49399002564/] [crayon-66433e6696b4f122384820/] First, we used the GetTempPath() method of the System.IO.Path class to get the path of a current user’s temporary folder. This method returned a string type value, which we stored in the $temporaryPath variable. […]

  • Remove Character from String in PowerShell
    14 February

    Remove Character from String in PowerShell

    Remove Character from String in PowerShell Using Replace() Method Use the Replace() method to remove character from a string in PowerShell. Replace() method replaces old character with new Character in the String. [crayon-66433e6696cb2433481955/] [crayon-66433e6696cb5262452348/] For the above code, we used the Replace() method to replace Character a with empty space which eventually remove character from […]