Powershell Script to search Active Directory user

Опубликовано: 02 Март 2026
на канале: Cybersecurity Striker
927
like

This Script does not require Powershell ISE Administrator
you could run in Powershell ISE (Standard)


param(

[Parameter(Mandatory=$True)]

[string]$UserName



)

#Put simply a parameter aka param() allows you to declare a variable. Declare means to says this is my variable I am using x

#When prompt you are prompt to enter a value you assign that variable a value aka initializing the variable. Basically you say this is my variables value example x =5

get-aduser $UserName



Get-ADPrincipalGroupMembership -identity $UserName | select-object -Property name

Get-ADUser $UserName | Select-Object -Property samaccountname,enabled

Get-ADUser $UserName | Select-Object -Property Name,Description