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
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.
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.
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.