prakash.thakor Posted April 12, 2012 Report post Posted April 12, 2012 Hi I am using SCCM 2007 R3 and I am deploying Windows 7 x64 with SP1. I want to Add the computer to the security group of AD. I have created the .vbs script as below Option Explicit Dim objSysInfo, objComputer, strComputerDN Dim objComputerGroup ' Retrieve DN if user and local computer. Set objSysInfo = CreateObject("ADSystemInfo") strComputerDN = objSysInfo.ComputerName ' Bind to user and computer objects. Set objComputer = GetObject("LDAP://" & strComputerDN) ' Bind to groups. You must specify the full Distinguished Names. Set objComputerGroup = GetObject("LDAP://CN=IndiaDesktopgroup,OU=Desktops,OU=COmputers,OU=India,DC=mydomain,DC=local") ' Add user and computer to groups, if not already members. If (objComputerGroup.IsMember(objComputer.AdsPath) = False) Then objComputerGroup.Add(objComputer.AdsPath) End If 1.I have tried creating package and added progrgram into it and use that program into task sequence 2. I have also tried Adding command line in task sequence but didnt help. and error comes "incorrect function" Pls see the below task sequence and error log Quote Share this post Link to post Share on other sites More sharing options...
Jorgen Nilsson Posted April 12, 2012 Report post Posted April 12, 2012 Hi, In your scenario above the script will be executed using the System Account on the client compouter which doesn't have permission in AD, so I would start by using a service account with the neceserray permissions. Check out the script I use to achieve the same thing, there is a description on how to implement it as well. http://ccmexec.com/2010/08/adding-computer-to-ad-groups-during-deployment/ regards, Jörgen Quote Share this post Link to post Share on other sites More sharing options...
prakash.thakor Posted April 12, 2012 Report post Posted April 12, 2012 Hi jorgon Pls explian how to set your script in my envorionment what is group1 ,group2, group3 how can pass group that is in OU (LDAP://CN=IndiaDesktopgroup,OU=Desktops,OU=COmputers,OU=India,DC=mydomain,DC=local) Pls help Thanks Prakash Quote Share this post Link to post Share on other sites More sharing options...
Jorgen Nilsson Posted April 12, 2012 Report post Posted April 12, 2012 Hi, IT takes care of that so just use the command line: wscript.exe addtogroup.vbs IndiaDesktopgroup And you are good to go. Regards, Jörgen Quote Share this post Link to post Share on other sites More sharing options...
prakash.thakor Posted April 12, 2012 Report post Posted April 12, 2012 Hi I have created a package called "SCCmScripts" and not added any program into and give the UNC path where the .vbs script is located. I have applied your script but still get the error "incorrect function". Pls see the below screenshots. Quote Share this post Link to post Share on other sites More sharing options...
prakash.thakor Posted April 13, 2012 Report post Posted April 13, 2012 Hi Jorgen Any update Can you pls guid me Thanks Quote Share this post Link to post Share on other sites More sharing options...
Peter van der Woude Posted April 13, 2012 Report post Posted April 13, 2012 When the script is in the root of your package it should work. Did you test the script outside the Task Sequence? Quote Share this post Link to post Share on other sites More sharing options...
prakash.thakor Posted April 13, 2012 Report post Posted April 13, 2012 Hi Peter, The script works fine when i run manually from the workstattion. Also I am using standard task sequence and not using MDT task sequence. Thanks Quote Share this post Link to post Share on other sites More sharing options...
Jorgen Nilsson Posted April 13, 2012 Report post Posted April 13, 2012 Hi, When you test run it manually, do you use the same service account? Does it work then? Regards, Jörgen Quote Share this post Link to post Share on other sites More sharing options...
prakash.thakor Posted April 14, 2012 Report post Posted April 14, 2012 Hi Jorgen, 1. Yes , I am running the script after logging into the desktop with the same account after OS is deployed. 2. What is the error mean "incorrect function" when\why it comes. Thanks Prakash Quote Share this post Link to post Share on other sites More sharing options...