PowerShell AD
- 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 […]
- 20 August
Get Fully Qualified Domain Name in PowerShell
Using Environment Variable Use an environment variable to get a fully qualified domain name. [crayon-676767c5934c3589955760/] [crayon-676767c5934cc062522405/] 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 […]
- 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-676767c5965f4764112768/] [crayon-676767c5965fc027754230/] 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 […]
- 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-676767c599e74707007037/] [crayon-676767c599e7d982012773/] First, we initialized the $username variable with the Administrator; this was the […]
- 04 May
Check if AD User Exists in PowerShell
In PowerShell, we must import the ActiveDirectory module to use the Get-ADUser cmdlet. If you have imported it already, you can jump to the Checking If AD User Exists in PowerShell section; otherwise, let’s continue with us step-by-step below. Installing the ActiveDirectory Module To import the ActiveDirectory module, we first need to install it. So, […]
- 15 April
PowerShell Get Ad User Account Expiration Date
Using Get-AdUser Cmdlet with Select-object cmtlet Use the Get-AdUser with Select-object to get the ad user account expiration date in PowerShell. [crayon-676767c5a1b72636889301/] [crayon-676767c5a1b7c187565702/] Here, the PowerShell cmdlet Get-ADUser was used to retrieve the information about the users of the Active Directory as it is a centralized system. Now, what is Active Directory? Microsoft provides directory […]
- 24 December
Get AD User Description in PowerShell
To get AD user description in powerShell, use Get-AdUser cmdlet with -Properties as Description. [crayon-676767c5a3c1b578531417/] Please note that you must must first install the Remote Server Administration Tools (RSAT) package and import the Active Directory module. Get AD User Description and Attributes in PowerShell The Get-ADUser cmdlet is a powerful tool in the Active Directory […]