Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Get AD User's Groups (Remote LoggedOnUser)

Hey,

A simple tool I use to check the AD Groups of a LoggedOnUser, on a Remote Computer.

 

#Recuperation Username distant :
$user = (Get-WmiObject -ComputerName $(Computer:TARGETHOSTNAME) -Class win32_computersystem).username.split("\")[1]

#On cherche et affiche les groupes AD :
$ADUserInfo = Get-ADUser $user -Properties *
Write-Host "L'utilisateur $user est membre des groupes :" -ForegroundColor Cyan
$ADUserInfo.MemberOf

 

Screenshots :

 

0

Comments

0 comments