Tjindarr Posted September 23, 2010 Report post Posted September 23, 2010 Is there a way to add a computer to a security group with the help of the windows 7 installation task sequence? Quote Share this post Link to post Share on other sites More sharing options...
0 Tjindarr Posted September 23, 2010 Report post Posted September 23, 2010 Is there a way to add a computer to a security group with the help of the windows 7 installation task sequence? I found this when i googled abit but im not to familiar with scripts... where do i input our domain and group information? Const ADS_PROPERTY_APPEND = 3 Set WshShell = WScript.CreateObject("WScript.Shell") '----Get Computer DN------ Set objADSysInfo = CreateObject("ADSystemInfo") ComputerDN = objADSysInfo.ComputerName strcomputerdn = "LDAP://" & computerDN Set objADSysInfo = Nothing '----Connect AD----- Set oRoot = GetObject("LDAP://rootDSE") strDomainPath = oRoot.Get("defaultNamingContext") Set oConnection = CreateObject("ADODB.Connection") oConnection.Provider = "ADsDSOObject" oConnection.Open "Active Directory Provider" '-----Read commandline--- Set args = WScript.Arguments For i = 0 To Args.Count - 1 'wscript.echo Args.Item( i ) addgroup Args.Item( i ) next Function Addgroup(groupname) '----Get Group DN------ Set oRs = oConnection.Execute("SELECT adspath FROM 'LDAP://" & strDomainPath & "'" & "WHERE objectCategory='group' AND " & "Name='" & GroupName & "'") If Not oRs.EOF Then strAdsPath = oRs("adspath") End If Set objGroup = GetObject (stradspath) Set objComputer = GetObject (strComputerDN) If (objGroup.IsMember(objComputer.AdsPath) = False) Then objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array(computerdn) objGroup.SetInfo End If End Function Quote Share this post Link to post Share on other sites More sharing options...
0 Tjindarr Posted October 1, 2010 Report post Posted October 1, 2010 Got it sorted out. was to quick and didnt read the guide i found carefully enough the script is finished as it is. Just add it to a task sequence just after the SCCM client installation and run it as an account with the proper permission. "filename.vbs" adgroup1 adgroup2 adgroup3 Found all this here http://ccmexec.com/?p=364 Quote Share this post Link to post Share on other sites More sharing options...
Is there a way to add a computer to a security group with the help of the windows 7 installation task sequence?
Share this post
Link to post
Share on other sites