Solved

SCCM - using vbscript to set computer name....no longer joins domain

Posted on 2011-09-12
4
531 Views
Last Modified: 2012-05-12
Hi

I have created a script that will name computers when imaging computers in sccm during a task sequence.

Ive added this task just before the "Apply Windows Settings" task.

The computer then does not join the domain (it joins the domain if i remove this task). I have looked at the answer file and the computer name is added and the answer file does validate when used in Windows Image Manager.

Can anyone help with the computer naming step? Am I putting the step in the wrong location?

Thanks in advance
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") 

Set colSMBIOS = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure") 
For Each objSMBIOS in colSMBIOS 
	strNewName = objSMBIOS.SerialNumber 
Next
strNewName = "XYZ-" & Ucase(strNewName)
 
Set env = CreateObject("Microsoft.SMS.TSEnvironment") 
env("OSDCOMPUTERNAME") = strNewName
WScript.Echo "New computer name is " & strNewName

Open in new window

0
Comment
Question by:staino1983
  • 2
4 Comments
 
LVL 3

Expert Comment

by:Motaba
ID: 36528107
You have to restart computer after change computer name
and before joining domain.

Just add RESTART step.
0
 
LVL 10

Expert Comment

by:Kezzi
ID: 36536200
have you tried removing the Echo line from the script?
0
 

Accepted Solution

by:
staino1983 earned 0 total points
ID: 36540013
Hi Everyone

Thanks for the help.

The problem turned out to be the delegation permissions of the user account used to join the computer to the domain. It did not have permission to join a computer account if it already existed (for example if the computer account was already in the computers OU, the account did not have permission to move that account to the Windows 7 OU).

 

Regards
0
 

Author Closing Comment

by:staino1983
ID: 36558828
discovered the solution myself
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question