Jump to content


prakash.thakor

Join computer to AD Security Group using .vbs during OS Task Sequence

Recommended Posts

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

 

post-15600-0-94094200-1334206069_thumb.png

 

post-15600-0-75527700-1334206071_thumb.png

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.