stefanba Posted March 16, 2009 Share Posted March 16, 2009 Hello, sorry my english is not so good.... i need a if/else function with a query to localgroups on an W2k3 Terminalserver. The Server runs in a Domain and on the server are 3 localgroups with domainusers included dependent from the loginusername i want to start a different program with autoit. please can you help me ??? Link to comment Share on other sites More sharing options...
foster74 Posted March 16, 2009 Share Posted March 16, 2009 dependent from the loginusername i want to start a different program with autoit.Look under Run in the help file, is this what you mean? Link to comment Share on other sites More sharing options...
stefanba Posted March 16, 2009 Author Share Posted March 16, 2009 i mean: if userA in LocalGroup "Applicatipon1_User" then start Application1 else start Application2 the run command i know, but not the query for localgroups Link to comment Share on other sites More sharing options...
babou Posted March 16, 2009 Share Posted March 16, 2009 I want to do the same thing, this is what i found : $Name = InputBox("Group", "Login", "", "", 100, 100, 100, 100) If @error Then Exit If $Name = "" Then Exit Local $objUser = ObjGet("WinNT://" & @computername & "/" & $Name) For $oGroup in $objUser.Groups MsgBox(4096, "Groups", $oGroup.Name, 10) Next But it works on local account, not on DomainUser. When i change "@computername" with "@logondomain" it give me DomainGroup, not LocalGroup ... Link to comment Share on other sites More sharing options...
stefanba Posted March 16, 2009 Author Share Posted March 16, 2009 i have see thois post via boardquery...in my case bad... Link to comment Share on other sites More sharing options...
babou Posted March 16, 2009 Share Posted March 16, 2009 Look at that it works for me expandcollapse popup#Include <Array.au3> $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler Local $objDomain = ObjGet("WinNT://" & @ComputerName & "" ) $answer = InputBox("Question", "Quel User ???", "Nom du USER", "", _ -1, -1, 0, 0) $objUser = ObjGet("WinNT://" & @LogonDomain & "/" & $answer) Dim $filter[1] = ["group"] $objDomain.Filter = $filter local $LocalGroup ="" ;~ Recupère les groupes locaux For $aUser In $objDomain $objGroup = ObjGet("WinNT://" & @ComputerName & "/" & $aUSer.Name) For $objMember In $objGroup.Members() If $objMember.Name = $objUser.Name Then MsgBox(0,"",$objUser.Name & " est un membre de " & $objGroup.Name & @CRLF) ExitLoop EndIf Next Next ;COM Error function Func ComError() If IsObj($oMyError) Then $HexNumber = Hex($oMyError.number, 8) ConsoleWrite($oMyError.scriptline & ' $HexNumber = ' & $HexNumber & "Windescription is: " & $oMyError.description & "|" & $oMyError.windescription & @lf);### Debug Console SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc;==>ComError 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