Powershell - Useful basics

powershell
active-directory
Tags: #<Tag:0x00007f9ff8de9488> #<Tag:0x00007f9ff8de91b8>

#1

Powershell: lookup an AD user

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> Import-Module ServerManager
PS C:\Windows\system32> Add-WindowsFeature RSAT-AD-Powershell

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Remote Server Administration Tools, Activ...


PS C:\Windows\system32> get-aduser -f {sAMAccountName -eq 'myuser'}


DistinguishedName : CN=Finreach,OU=XYZ,OU=ADMIN,OU=SOMEWHERE,DC=domain-int,DC=net
Enabled           : True
GivenName         : MYUSER
Name              : Myuser
ObjectClass       : user
ObjectGUID        : 123
SamAccountName    : myuser
SID               : S-1-5-21-321
Surname           :
UserPrincipalName : [email protected]