Relative Content

Tag Archive for powershellactive-directory

Get-ADGroup member count domain issue

I’m rather new to Powershell. I need to gather a list of certain Groups and the member count of these and the nested groups. I first used Get-ADGroupMember.

extract specific string from the field returned

Class CustomAdInfo { $UserName $Group $Email $Manager } [char] ‘y’..[char] ‘z’ | ForEach-Object { $getADUserSplat = @{ Filter = “Name -like ‘$_*'” Properties = ‘SamAccountName’, ‘memberOf’, ‘EmailAddress’, ‘Manager’ ResultPageSize = 256 SearchBase = ‘CN=Users,DC=ab,DC=cd’ } foreach ($user in Get-ADUser @getADUserSplat) { foreach ($group in $user.MemberOf | Get-ADGroup) { [CustomAdInfo]@{ UserName = $user.SamAccountName Group = $group.Name […]