commenti Posted June 23, 2004 Share Posted June 23, 2004 Hi! I am new to AutoIT. I tried out some scripting and I like this language. I now think about migrating my current scripts (KIX-Script) to AuotIT. So far everything I tried worked well. But now I have a problem I could not solve seraching the help or the forum. Sorry if I´ve overseen this but how can I find out with AutoIT if a user is in group a b or c? or a +b or both or somehting like this. I want to have somehting like this. User is logged in to domain EXAMPLE. IfInGroup "booking" netuse U: //Example/exampleDir1 EndIF IfINGroup "booking" netuse Y: //Example/exampleDir2 EndIF How can I do something like this in AutoIT? I would be happy for a little help. Perhaps I have only overseen the commands to deterimine if a user belongs to a certain group. Commenti Link to comment Share on other sites More sharing options...
nobby Posted June 24, 2004 Share Posted June 24, 2004 Welcome to the world of Microsoft's lack of functionality.There are a couple of utilities out there that query a domain for group memberships. Here is a link to some articles: http://www.jsiinc.com/SUBL/tip5700/rh5772.htmIf you want to do it without the utils, you must first query the domain using:net user /DOMAIN userPipe the result into a text filenet user /DOMAIN user > c:\temp\result.txtThen find the string you are looking for using this scriptTo find the string "GroupA" in the file result.txt//Get the user details and pipe to a text file RunWait(@ComSpec & " /c " & 'net user /DOMAIN user > c:\temp\result.txt', "", @SW_HIDE) //Query the text file $a = RunWait('find /n "GroupA" C:\temp\result.txt',"",@SW_HIDE) //Do some if stuff If $a = 1 Then MsgBox(4096,"",'user is NOT part of "GroupA"') Else MsgBox(4096,"",'user is part of "GroupA"') EndIfIt relies on the good ol DOS, but it should work. Cheers Nobby CheersNobby Link to comment Share on other sites More sharing options...
sugi Posted June 24, 2004 Share Posted June 24, 2004 Microsoft supplies an own utility for this within the Windows Ressource Kits (called ifmember.exe) Link to comment Share on other sites More sharing options...
commenti Posted June 28, 2004 Author Share Posted June 28, 2004 Hi! Thank you, both of you. I would prefer a function to determine groups in autoit, but your suggestion do at least work. From this two I think, I´ll use nobbys idea and make an autoit function out of it. Both suggestions have the problem, that I have to rely on extra soft (o.k. net user should be avaible at least on all W2K and WXP Maschines). That was better in kix-script, there I had a function like this: IF InGroup( "Hello") Do something EndIF. But with nobbys idea its at least possible to write a workaround for that. I miss some more functions. I think I´ll try to code workarounds in autoit. If they are ready I´ll post them. Thanx again for your help. commenti Link to comment Share on other sites More sharing options...
commenti Posted July 6, 2004 Author Share Posted July 6, 2004 Hi!Meanwhile I posted the function InGroup that I made after nobby´s hint and code example here:http://www.autoitscript.com/forum/index.ph...t=ST&f=9&t=3597Thanx again for the help.commenti Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now