# Learning powershell, how to get all properties of an AD user

**URL:** <https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148>\
**Category:** PowerShell Help\
**Created:** [October 26, 2020, 2:49pm UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148 "2020-10-26T14:49:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcas19](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@mcas19](https://forums.powershell.org/u/mcas19)\
**Post date:** [October 26, 2020, 2:49pm UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/1 "2020-10-26T14:49:07Z")

</div>

I have an assignment in my class that asks me to “Using Get-ADUser, obtain a list of the users added in the previous step. Pipe the output to Export-CliXML. Using the Import-CliXML, display the objects generated from the CliXML file that you just created. In the display, look for the user that was added to multiple groups – you should see reference to this user’s groups.” I created a line that gets me the list of users, but I can’t seem to figure out how to add the groups to it and get it functioning.

This is my current line

Get-ADUser -Filter \* -SearchBase “DC=cls,DC=com”|Select name |Export-Clixml -path C:\userlist.xml

I tried adding groups, security groups, membersof, ect in the select category but they come out blank

&nbsp;

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [October 26, 2020, 8:40pm UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/2 "2020-10-26T20:40:21Z")

</div>

You should be using -Properties parameter of Get-AdUser cmdlet to select them , as by default very few properties will be displayed and groups, security groups, membersof are not part of it.

---

<div class="post-metadata">

**Author:** ![mcas19](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@mcas19](https://forums.powershell.org/u/mcas19)\
**Post date:** [October 27, 2020, 6:36am UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/3 "2020-10-27T06:36:51Z")

</div>

so would it be more like this?

Get-ADUser -Filter \* -SearchBase “DC=cls,DC=com” -Properties type |Export-Clixml -path C:\userlist.xml

when I try it like that I get an error saying properties are invalid.

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [October 27, 2020, 7:48am UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/4 "2020-10-27T07:48:16Z")

</div>

what is “type” here ? you can see it once by using -Properties \*, but using it in script will give all the properties and will be too much.  
So once select all using \* will show you all the available properties then can be decided to select required prorpties.

---

<div class="post-metadata">

**Author:** ![dhrubbharali](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/dhrubbharali/32/47_2.png) [@dhrubbharali](https://forums.powershell.org/u/dhrubbharali)\
**Post date:** [October 28, 2020, 11:09am UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/5 "2020-10-28T11:09:57Z")

</div>

```
Get-ADUser -Filter * -properties *|select Name,groups, security groups, membersof|Export-Clixml -path C:\userlist.xml
```

Looking at your script and requirement it should be as of and -searchbase is not required as you are querying the whole domain. Searchbase is used for a particular OU in domain.

If you want to check scripts like this you are welcome to visit [https://www.powershellguru.com/ad](https://www.powershellguru.com/ad)

---

<div class="post-metadata">

**Author:** ![mcas19](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@mcas19](https://forums.powershell.org/u/mcas19)\
**Post date:** [October 28, 2020, 12:58pm UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/6 "2020-10-28T12:58:24Z")

</div>

sorry for no responding, was working on another assignment. When I try the script above I get the following error

PS C:&gt; Get-ADUser -Filter \* -properties \*|select Name,groups, security groups, membersof|Export-Clixml -path C:\userlist.xml

Select-Object : A positional parameter cannot be found that accepts argument ‘System.Object’.  
At line:1 char:36

- … -properties \*|select Name,groups, security groups, membersof|Export- …
- 

```auto

```

- CategoryInfo : InvalidArgument: (🙂 [Select-Object], ParameterBindingException
- FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [October 28, 2020, 9:28pm UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/7 "2020-10-28T21:28:19Z")

</div>

When using properties with space, it should be wrapped in quotes ‘security groups’.

But AFAIK, ‘security groups’ and groups are not properties of a AD user object.

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [October 29, 2020, 1:56pm UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/8 "2020-10-29T13:56:20Z")

</div>

> [@](#):
>
> But AFAIK, ‘security groups’ and groups are not properties of a AD user object.

They are not. To see all the properties he can run

```
(Get-ADUser -Filter * -Properties * |
    Select-Object -First 1 | Get-Member -MemberType Property).name
```

These are the names of all the properties on an AD user. of course I’d limit this to one user if you could using -Filter

```
(Get-ADUser -Filter "name -like '*someusername*'" -Properties * | Get-Member -MemberType Property).name
```

---

<div class="post-metadata">

**Author:** ![david-schmidtberger](https://avatars.discourse-cdn.com/v4/letter/d/ba9def/32.png) [@david-schmidtberger](https://forums.powershell.org/u/david-schmidtberger)\
**Post date:** [November 2, 2020, 4:44am UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/9 "2020-11-02T04:44:00Z")

</div>

i’d make it even simpler, if you have the details of a user, no reason to user -filter

get-aduser samaccountname\_of\_user\_here -prop \*

you can then either select name, or look at the properties with a value included, I find that much easier to parse than just the list of names

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [November 2, 2020, 5:48am UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/10 "2020-11-02T05:48:00Z")

</div>

If they have the samaccountname, sure. Otherwise filter.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:28pm UTC](https://forums.powershell.org/t/learning-powershell-how-to-get-all-properties-of-an-ad-user/15148/11 "2024-05-16T20:28:38Z")

</div>

Closed on May 16, 2024, 8:28pm UTC


