Output List of User's Groups
369
Solution 1
dsquery user -name "My Full Name" | dsget user -memberof | dsget group -samid
I found this pretty much gives me what I was looking for, in case anyone was curious! :)
Solution 2
Use PowerShell!
$user = [wmi] "Win32_UserAccount.Name='JohnDoe',Domain='YourDomainName'"
$user.GetRelated('Win32_Group')
or only for group names:
$user = [wmi] "Win32_UserAccount.Name='JohnDoe',Domain='YourDomainName'"
$user.GetRelated('Win32_Group') | Select Name
Solution 3
Hmm.
net user paul /domain | find "Global Group memberships"
Will give you the the groups, but if you don't want the header you'd need something more involved:
for /f "tokens=4*" %f in ('net user paul /domain ^| find "Global Group memberships"') do echo %f
So %f contains the groups.
Related videos on Youtube
Author by
Rajan
Updated on September 18, 2022Comments
-
Rajan over 1 year
i was working on Codeigniter Application in WAMP and then i had to move my project to a LINUX machine.
Now When i have installed LAMP there. but When i try to access my application i get an error:
An Error Was Encountered
Unable to load the requested file: helpers/url_helper.php
i checked my autoload.php. This worked on my windows don't why its not working here.
$autoload['helper'] = array('url','html','crm_helper','form');
Can you please guide me where i am going wrong?
-
Admin over 12 yearsIs writing a custom tool in Python or C# acceptable?
-
Admin over 12 yearsThat's beyond my capabilities but if you can get me something that I can compile and execute I'd certainly be very thankful :)
-
Admin over 12 yearsThis isn't something you'd normally want to do in Windows. Can you explain why you want the output in this particular format? We may be able to suggest an alternative.
-
saurabh kamble over 8 yearswhich one is not working add one by one and check
-
itsols over 8 yearsDid you copy the folders from Windows to Linux or is it a fresh installation from download?
-
itsols over 8 yearsI think your problem is that you don't have the crm_helper in the correct path, or you don't have it at all.
-
Rajan over 8 yearsonce i remove any helper from the autoload it start pointing to other helper for error @saurabhkamble
-
Rajan over 8 years@itsols i removed crm_helper from my autoload still doesnt works
-
saurabh kamble over 8 years@Rajan add that error in the question
-
Rajan over 8 yearsi already have its just shows me Unable to load the requested file: helpers/url_helper.php
-
Rajan over 8 yearsi have added the screen shot see @saurabhkamble
-
saurabh kamble over 8 years@Rajan your are using url function and you not auto-loaded url helper now just add url helper in it
-
Rajan over 8 years@saurabhkamble so i should manually load the url helper? or shall i put it in autload.php?
-
saurabh kamble over 8 years@Rajan try both ways
-
Rajan over 8 yearstried both @saurabhkamble but i think there is some reconfiguration in my installation so
-
saurabh kamble over 8 yearsLet us continue this discussion in chat.
-
Tpojka over 8 yearsUse master version instead of develop one.
-
-
Smitty over 12 yearsThanks, that kinda looks like what I'm after but the first example only outputs data from that line, if there are say a dozen groups, most won't show and the second example you gave is giving me the error "f was unexpected at this time" from what I gather, it's not liking the final "%f", I'm just a beginner with these batch scripts :)
-
Paul over 12 yearsIf you use it in a script, you need to use %%f. Yes, good point, the output will wrap and get lost. Do you have an output you can paste, I don't have the right setup to test. It may need something more robust than hacking bits out of the
net user
command :)