ter-pierre Posted August 21, 2006 Share Posted August 21, 2006 Hi guys. Anyone knows a samle code to add a domain global group to a local computer group? I am trying to add the domain group called GG_WS_ADM to the local Administrators group of my workstations thougth our logon script. Thanks for the help. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 21, 2006 Developers Share Posted August 21, 2006 Hi guys. Anyone knows a samle code to add a domain global group to a local computer group? I am trying to add the domain group called GG_WS_ADM to the local Administrators group of my workstations thougth our logon script. Thanks for the help.Something like this should work: RunWait(@ComSpec & " /c net localgroup administrators /ADD " & @LogonDomain & "\GG_WS_ADM" ,"",@SW_HIDE) Or you can use the COM method.... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 21, 2006 Share Posted August 21, 2006 (edited) Hi guys. Anyone knows a samle code to add a domain global group to a local computer group? I am trying to add the domain group called GG_WS_ADM to the local Administrators group of my workstations thougth our logon script. Thanks for the help. This is my function for to add any user (local or domain) to any group (local or domain): expandcollapse popup;-------------------------------------- ; Function _Add_Usr2Grp() ; Call with: _Add_Usr2Grp($sNewGrpMbr, $sGrpName) where: ; $sNewGrpMbr = New member to add to the group ; $sGrpName = local group name to add members to ; Returns 1 for good, 0 for bad ; ; Note: If the context is not given for user or group, i.e. format is "UserName", ; then local computer context will be assumed. Domain or remote computer context ; can be provided by formatting user or group as "Context/UserName". ;-------------------------------------- Func _Add_Usr2Grp($sNewGrpMbr, $sGrpName) ; Format user for local if context not given Local $aUserSplit = StringSplit($sNewGrpMbr, "\/", 0) If $aUserSplit[0] = 1 Then $sNewGrpMbr = @ComputerName & "/" & $sNewGrpMbr Else $sNewGrpMbr = StringReplace($sNewGrpMbr, "\", "/") EndIf ; Init user COM object Local $objUser = ObjGet("WinNT://" & $sNewGrpMbr) ; Format group for local if context not given Local $aGroupSplit = StringSplit($sGrpName, "\/", 0) If $aGroupSplit[0] = 1 Then $sGrpName = @ComputerName & "/" & $sGrpName ; Init group COM object Local $objGroup = ObjGet("WinNT://" & $sGrpName & ",group") ; Add the user to the group $objGroup.Add ($objUser.ADsPath) $objGroup.SetInfo ; Return Results If @error = 0 Then Return 1 Else Return 0 EndIf EndFunc ;==>_Add_Usr2GrpoÝ÷ ØÚ-zØ^ën®zÞ²ém²Ç¶*'uê^Û(l8Ç«®ájwez»¶Ø§ê뢶®¶sc²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒУ²gVæ7Föâô6öÔW'$gVæ2£²7W7FöÒ4ôÒö&¦V7BW'&÷"æFÆW £²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒФgVæ2ô6öÔW'$gVæ2 Æö6Âb33c´WçVÖ&W"ÒWb33c¶ô6öÔW'&÷"æçVÖ&W" ôfÆUw&FTÆörb33c´ÆötfÆRÂgV÷C´WFôB4ôÒW'&÷"ö67W&VBb333²gV÷C²fײ5$Äbfײð D"fײgV÷C´W'&÷"çVÖ&W#¢gV÷C²fײb33c´WçVÖ&W"fײ5$Äbfײð D"fײgV÷C´ÆæRçVÖ&W#¢gV÷C²fײb33c¶ô6öÔW'&÷"ç67&FÆæRfײ5$Äbfײð D"fײgV÷C´FW67&Föã¢gV÷C²fײb33c¶ô6öÔW'&÷"æFW67&Föâfײ5$Äbfײð D"fײgV÷CµväFW67&Föã¢gV÷C²fײb33c¶ô6öÔW'&÷"çvæFW67&Föâ 6WDW'&÷"²6öÖWFærFò6V6²f÷"vVâF2gVæ7Föâ&WGW&ç0¤VæDgVæ2³ÓÒfwCµô6öÔW'$gVæ Compare that to JdeB's answer and you get kind of a travisty of the KISS principle, don't 'cha? Edited August 21, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ter-pierre Posted August 22, 2006 Author Share Posted August 22, 2006 Great PsaltyDS!!! Thanks. 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