Activedirectory: Difference between revisions

From Piszczynski
piszczynski>Aleks
piszczynski>Aleks
No edit summary
Line 29: Line 29:
Find login scripts for all users and export to text file:
Find login scripts for all users and export to text file:
*Get-ADUser -filter * -properties scriptpath, homedrive, homedirectory | ft Name, scriptpath, homedrive, homedirectory | out-file C:\temp\logonscriptoutput.txt
*Get-ADUser -filter * -properties scriptpath, homedrive, homedirectory | ft Name, scriptpath, homedrive, homedirectory | out-file C:\temp\logonscriptoutput.txt
== Setting up Active directory ==
Handy basic info for configuring an active directory domain:
https://social.technet.microsoft.com/wiki/contents/articles/34981.active-directory-best-practices-for-internal-domain-and-network-names.aspx

Revision as of 12:21, 31 July 2022

Active Directory

Handy PowerShell script to add AD group members from one group to another:

Add-ADGroupMember -Identity 'New Group' -Members (Get-ADGroupMember -Identity 'Old Group' -Recursive)


Reset password in powershell

  • $pw = Read-Host "password" -AsSecureString
    • Set-ADAccountPassword <username> -Reset -NewPassword $pw

Unlock account

  • Unlock-ADAccount -Identity <user>

Check account is locked/unlocked

  • Get-ADUser -Identity <user> -properties Lockedout | Select Name,LockedOut

Search for adusers using powershell:

Can be used with various options: DistinguishedName, Enabled, GivenName, Name, ObjectClass, Object GUID, SamAccountName, SID, Surname, UserPrincipalName.

  • get-aduser -filter "name -eq '<name of user>'"

See all properties for an active directory user account:

  • Get-ADuser -identity <user> -properties *

Find login scripts for all users and export to text file:

  • Get-ADUser -filter * -properties scriptpath, homedrive, homedirectory | ft Name, scriptpath, homedrive, homedirectory | out-file C:\temp\logonscriptoutput.txt


Setting up Active directory

Handy basic info for configuring an active directory domain:

https://social.technet.microsoft.com/wiki/contents/articles/34981.active-directory-best-practices-for-internal-domain-and-network-names.aspx