Solved

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

Posted on 2011-09-12
4
534 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Journal Entry Posting in a Different Currency from the Subledger's Currency 1 151
cron.exe SCOM alert 3 56
HxTsr.exe consuming resources 2 674
SCOM logon account permissions? 1 38
Microsoft has released remote PowerShell capabilities to all commercial Office 365 customers. So you can be controlled via PowerShell and not from the Office 365 admin center Download Windows PowerShell Module for Lync Online http://www.micros…
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…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

739 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