{"id":3,"date":"2009-10-24T10:04:15","date_gmt":"2009-10-24T14:04:15","guid":{"rendered":"http:\/\/enterpriseadmins.org\/blog\/?p=3"},"modified":"2009-10-24T10:04:15","modified_gmt":"2009-10-24T14:04:15","slug":"add-domain-group-to-local-group","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/add-domain-group-to-local-group\/","title":{"rendered":"Add domain group to local group"},"content":{"rendered":"<p style=\"margin-top: 0px; margin-bottom: 5px; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #333333; text-align: justify;\">This script was designed to be run by a domain\u00a0administrator to grant other groups access to Administrators or Power Users on a local machine.\u00a0 It reads in a list of computers from a text file and attempts to add the specified domain group to a specified local group.\u00a0 An error log (success, fail, error message) will be written so that you know which workstations were correctly updated.<\/p>\n<p style=\"margin-top: 0px; margin-bottom: 5px; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #333333; text-align: justify;\">This is a useful script to grant a desktop support group access to a list of workstations without giving them domain administrator permissions.<\/p>\n<p><code><br \/>\nOn Error Resume Next<\/code><\/p>\n<p><code> <\/code><\/p>\n<p><code>Set oFSO = CreateObject(\"Scripting.FileSystemObject\")<br \/>\nSet oInFile = oFSO.OpenTextFile(\"computers.txt\")<br \/>\nSet oLogFile = oFSO.OpenTextFile(\"Output.log\",8,True)<br \/>\nStartTime = Now<br \/>\nComputerCount = 0<\/p>\n<p>While Not oInFile.AtEndOfStream<br \/>\nsComputerName = Trim(oInFile.ReadLine)<br \/>\nIf Not sComputerName = \"\" Then<br \/>\nComputerCount = ComputerCount + 1<br \/>\nsLGroup = \"Administrators\"<br \/>\nsGGroup = \"Workstation Admins\"<br \/>\nsDC = \"testing.root.local\"<\/p>\n<p>Message = \"Error adding Global to Local on \" &amp; sComputerName<\/p>\n<p>Set oLGroup = GetObject(\"WinNT:\/\/\" &amp; sComputerName &amp; \"\/\" &amp; sLGroup &amp; \",group\")<br \/>\nSet oGGroup = GetObject(\"WinNT:\/\/\" &amp; sDC &amp; \"\/\" &amp; sGGroup &amp; \",group\")<br \/>\nReturnCode = oLGroup.Add(oGGroup.ADsPath)<\/p>\n<p>If Err.Number = \"-2147023518\" then<br \/>\nMessage = sGGroup &amp; \" is already a member of \" &amp; sLGroup &amp; \" on \" &amp; sComputerName<br \/>\nElseIf Err.Number = \"0\" Then<br \/>\nMessage = oGGroup.Name &amp; \" is now in \" &amp; oLGroup.Name &amp; \" on computer \" &amp; sComputerName<br \/>\nEnd If<\/p>\n<p>oLogFile.WriteLine (Message)<br \/>\nEnd If<br \/>\nWend<\/p>\n<p>MsgBox ComputerCount &amp; \" machines were processed in \" &amp; DateDiff(\"S\", StartTime, Now) &amp; \" seconds.\"<\/p>\n<p><\/code><\/p>\n<p><code>WScript.Quit<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This script was designed to be run by a domain\u00a0administrator to grant other groups access to Administrators or Power Users on a local machine.\u00a0 It reads in a list of computers from a text file and attempts to add the &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/add-domain-group-to-local-group\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3","post","type-post","status-publish","format-standard","hentry","category-scripting"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/3","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=3"}],"version-history":[{"count":5,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/3\/revisions"}],"predecessor-version":[{"id":8,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/3\/revisions\/8"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=3"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=3"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=3"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}