Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-12
4
Medium Priority
?
540 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Experts-Exchange users below are the steps you can follow to upgrade your Lync server to latest CU's or cumulative updates. Note: Perform it during non-production hours.   Step 1: Backup your lync and SQL server database. Follow below article: h…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

636 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