?
Solved

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

Posted on 2011-09-12
4
Medium Priority
?
538 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

770 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