Jump to content


Change Computer name during SCCM 2012 OSD TS

Recommended Posts

I am moving from WDS to SCCM 2012 for OSD. I have the image ready and deploys very nicely. The one thing that we need to do is, change the computer name based on the serial number. We set all of our names with the asset tag in the name. We have a DB that we scan all Serials, Asset Tags, Computer Name in.


For example:

Asset Tag: XXXXX


Serial Number: 123456


Would have a computer name: LC0D401TO1XXXXX


When using WDS we did this after the OS was installed using a bat file (code below). Now when doing this in SCCM 2012, the name either will not change or the computer will be deleted from the domain.


Any help would be great!!

set newMN=
cscript.exe \\file_Location\inventory-sn.vbs //nologo %computername%>c:\install\machsn.txt
FOR /f %%p IN (c:\install\machsn.txt) DO SET machisn=%%p
find /c /i ",%machisn%," \\file_location\MNs.txt

FOR /f "tokens=1,2,3 delims=," %%q in ('findstr /s %machisn% \\File_Location\MNs.txt') DO SET newMN=%%s

NETDOM RENAMECOMPUTER %newMN% /NewName:%MACHNAME% /userD:domain\user /PasswordD:**** /FORCE

Share this post

Link to post
Share on other sites

In ConfigMgr you have to start using task sequence variables. In this case your script has to create and set the OSDComputerName variable to your computer name,

Thank You so much for your help! I will check this out and let you know how it goes...

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...