• Get Value by Key in PowerShell
    06 February

    PowerShell – Get Value by Key in HashTable

    Getting Single Value by Single Key We can get a single value by a single key in a hash table using the following ways in PowerShell: Indexer Notation .Item() Method Dot Notation Where-Object Cmdlet Use Indexer Notation Use indexer notation represented with square brackets ([]) to get a value by key in HashTable in PowerShell. […]

  • Array of HashTables in PowerShell
    02 February

    PowerShell – Array of HashTables

    Creating an Array of HashTables To create an array of hashtables in PowerShell: Create an array. Create two or more hash tables. Use += operator to add the hash tables (created in the second step) to an array (created in the first step). [crayon-676ab8b65ba07555747043/] [crayon-676ab8b65ba0d868176947/] First, we used an array operator represented with @() to […]

  • Write Binary Files in PowerShell
    01 February

    Write Binary Files in PowerShell

    Using Add-Content Cmdlet Use the Add-Content cmdlet to write binary files in PowerShell. [crayon-676ab8b65bbad520539511/] This script created a new file named test.bin in the current working directory and wrote the binary data to the file. The script will append data to the existing file if the file already exists. First, we stored the array of […]

  • 01 February

    What Does Percent(%) Mean in PowerShell

    Using Percent (%) in Different Contexts Typically the % character is for mod functionality. But in PowerShell, it’s an alias for ForEach-Objectand can be also used as Modulus Operator and an Assignment Operator (%=). Let’s learn each of them below. Use Percent(%) as an alias of the ForEach-Object cmdlet in PowerShell We can use % […]

  • 28 January

    PowerShell – Get Number of Lines in CSV File

    Using Get-Content Cmdlet The Get-Content cmdlet can be used in the following ways to get the number of lines in the specified .csv file: Get-Content cmdlet with .Length property Get-Content cmdlet with .Count property Get-Content cmdlet with .ReadCount property Get-Content cmdlet with Measure-Object cmdlet and its -Line parameter Before moving towards the ways mentioned above, […]

  • Read CSV file in PowerShell
    28 January

    Read CSV File in PowerShell

    Using the Import-Csv Cmdlet To read a CSV file in PowerShell, use the Import-Csv cmdlet. [crayon-676ab8b65c919410318178/] [crayon-676ab8b65c91d692341316/] PowerShell provides several cmdlets that allow us to work with CSV files: Import-Csv ConvertFrom-Csv Export-Csv ConvertTo-Csv These cmdlets allow us to easily read, write, and manipulate CSV data in PowerShell, but Import-Csv and ConvertFrom-Csv are primarily used to […]

  • Read File into String in PowerShell
    27 January

    Read File into String in PowerShell

    Using the Get-Content Cmdlet We can use the Get-Content cmdlet to read the contents of a file into a string. Use the Get-Content Cmdlet to Read a Single File To read a single file into a string in PowerShell: Use the Get-Content cmdlet with the -Raw parameter to read the file’s contents into a string. […]

  • Get String between two characters in JavaScript
    27 January

    Get String Between Two Characters in JavaScript

    💡TL;DR Use the substring() method to get String between two characters in JavaScript. [crayon-676ab8b65cc84226277763/] [crayon-676ab8b65cc89730194820/] Here, we got String between , and ! in above example. Using substring() Method Use the substring() method to extract a substring that is between two specific characters from the given string in JavaScript. [crayon-676ab8b65cc8b007225676/] [crayon-676ab8b65cc8c150008876/] The substring() method allows […]

  • Remove property from Object in PowerShell
    27 January

    Remove Property from Object in PowerShell

    Using PSObject.Properties.Remove() Method To delete a property from an object in PowerShell, Use the New-Object cmdlet to create an object. Use the PSObject.Properties.Remove() method to remove a specific property from an object by providing the property’s name as a string parameter. [crayon-676ab8b65cfe3902716821/] [crayon-676ab8b65cfe7822297311/] In the above code, we have created an object called$person_obj having Name, […]