Solved

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

Posted on 2011-09-12
4
528 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
Comment Utility
You have to restart computer after change computer name
and before joining domain.

Just add RESTART step.
0
 
LVL 10

Expert Comment

by:Kezzi
Comment Utility
have you tried removing the Echo line from the script?
0
 

Accepted Solution

by:
staino1983 earned 0 total points
Comment Utility
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
Comment Utility
discovered the solution myself
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now