cant get username to display primary group query

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 13 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
cymba
Posts: 23
Last visit: Wed Apr 27, 2011 8:42 am

cant get username to display primary group query

Post by cymba »

need a little help with this script. this is a script that will query an users primary group. the problem I am having is that the particular user are not listed along with the primary group.

Bascally when i run the script it shows the primary group name, type(group) and DN. However I need the username from which the primary group was queried from to be displayed as well . Any help is greatly appreciated. Thanks c:username1.txt | get-qaduser | %{get-qadgroup "$($_.domain.sid)-$($_.primarygroupid)" }
User avatar
cymba
Posts: 23
Last visit: Wed Apr 27, 2011 8:42 am

cant get username to display primary group query

Post by cymba »

need a little help with this script. this is a script that will query an users primary group. the problem I am having is that the particular user are not listed along with the primary group.

Bascally when i run the script it shows the primary group name, type(group) and DN. However I need the username from which the primary group was queried from to be displayed as well . Any help is greatly appreciated. Thanks c:username1.txt | get-qaduser | %{get-qadgroup "$($_.domain.sid)-$($_.primarygroupid)" }
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

cant get username to display primary group query

Post by jvierra »

Code: Select all

	
get-qaduser  | %{"User:{0} Primary Group:{1}" -f $_.Name,(get-qadgroup "$($_.domain.sid)-$($_.primarygroupid)").Name }
	

See: http://downloads.sapien.com/?auth

Creae account and logon. Download PowerShell TFM - it's free. It will answer most of your questions on how to use PowerShell.


User avatar
cymba
Posts: 23
Last visit: Wed Apr 27, 2011 8:42 am

cant get username to display primary group query

Post by cymba »

cool, I will try it. thanks for the direction.
User avatar
cymba
Posts: 23
Last visit: Wed Apr 27, 2011 8:42 am

cant get username to display primary group query

Post by cymba »

not to be a burden, but can you briefly explain why your script structure work (i.e. the cmd that you implemented into the script(argh... hopefully that makes sense) or better yet what are the meaning of the parts you added?
Thanks for all your help just trying to understand, so I can stop bugging you so much on this forum... :)
This topic is 13 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked