• PowerShell get password policy for user in active directory
    20 August

    Get Password Policy for User in Active Directory in PowerShell

    Using Get-ADDefaultDomainPasswordPolicy Cmdlet The Get-ADDefaultDomainPasswordPolicy is used to get the default password policy for the specified domain. We can use it differently in different use cases; let’s learn a few of them below. Use the Get-ADDefaultDomainPasswordPolicy cmdlet with the -Current parameter to get the default password policy for the currently logged-on user in an active […]

  • PowerShell Get Proxy Settings
    20 August

    Get Proxy Settings in PowerShell

    1. Introduction In environments where internet access is controlled through a proxy, PowerShell scripts often need to be aware of these settings to function correctly. This article will guide you through different methods to get proxy settings using PowerShell, focusing on the proxy address, port, and its operational status. 2. Using Net.WebProxy Class The Net.WebProxy […]

  • PowerShell get Memory Usage Percentage
    20 August

    Get Memory Usage Percentage in PowerShell

    We can have multiple use cases for getting memory usage percentages. For example: Getting overall memory usage percentage Getting overall memory usage percentage history Getting memory usage percentage for one/all processes Let’s learn them one by one. Overcall Memory Usage Percentage We can use Get-Counter and Get-WmiObject cmdlets to retrieve the overall memory usage percentage. […]

  • PowerShell get fully qualified domain name
    20 August

    Get Fully Qualified Domain Name in PowerShell

    Using Environment Variable Use an environment variable to get a fully qualified domain name. [crayon-66069aa35dd53253521940/] [crayon-66069aa35dd58338657578/] First, we assigned the value of the environment variable ($evn:COMPUTERNAME) to the $computer_name variable. The environment variable COMPUTERNAME stored the current computer’s name or you can say the current host’s name; both meaning the same. Then, we assigned the […]

  • PowerShell loop through JSON File
    20 August

    Loop Through JSON File in PowerShell

    Using ConvertFrom-Json Cmdlet We can use the ConvertFrom-Json cmdlet to traverse the JSON file with first and nested-level keys; Let’s explore them below. Traverse JSON File Containing First-Level Keys Use ConvertFrom-Json with the foreach loop to traverse the JSON file having first-level keys only. [crayon-66069aa35e0b3165595295/] [crayon-66069aa35e0b9914418491/] [crayon-66069aa35e0bb382545897/] We used the Get-Content cmdlet to read the […]

  • PowerShell get history of Commands
    20 August

    Get History of Commands in PowerShell

    Using Get-History Cmdlet Using Get-History to get the complete history of the executed commands in PowerShell. [crayon-66069aa35e393486828936/] [crayon-66069aa35e398217735010/] In this example, the history of the commands is obtained using the Get-History cmdlet. On execution of the above code, we can see the list of executed commands is returned and displayed on the screen with their […]

  • PowerShell get password expiration date
    16 August

    Get Password Expiration Date in PowerShell

    Using Get-ADUser Cmdlet Use the Get-ADUser cmdlet to get the password expiration date for one specific user in an Active Directory. [crayon-66069aa35e5a6533565703/] [crayon-66069aa35e5ab122454263/] The Get-ADUser cmdlet is used to get one or multiple users from an active directory. We used it with the -Identity parameter to only get the Administrator user with SamAccountName and msDS-UserPasswordExpiryTimeComputed […]

  • PowerShell get ad user home directory and home drive
    16 August

    Get AD User Home Directory and Home Drive in PowerShell

    Using Get-ADUser Cmdlet We use Get-ADUser differently based on various use cases; let’s explore a few of them below. Get Home Directory & Drive for One User Use the Get-ADUser cmdlet to get the ad user’s home directory and home drive. [crayon-66069aa35e7c6748799987/] [crayon-66069aa35e7cc064559325/] First, we initialized the $username variable with the Administrator; this was the […]

  • PowerShell get mapped drive for all users
    16 August

    Get Mapped Drives for All Users in PowerShell

    Using net use Command Use the net use command to get mapped drives for all users in PowerShell. [crayon-66069aa35ea04204568761/] [crayon-66069aa35ea09915327967/] In the above example, we used the net use command to list all the mapped drives for all users on the local machine. Both drive letters (K: and Z:) were mapped to the same user. […]