Jump to content
DeployCentral

Assign Computer Name Unattended


dewin
 Share

Recommended Posts

Hello,

Is it posible to create you own Computer Name, Example (WI001) or is it posible to stop the SmartDeploy.xml so the Computer name can be manualy given?

<!-- 0 = Use the existing computer name, 1 = Use the following naming method -->

<naming_mode>0</naming_mode>

<naming_methods/>

<custom_naming_scheme/>

Thanks for the reply.

Kind regards

Dewin

Link to comment
Share on other sites

Hello Dewin,

SmartDeploy offers a number of ways to name target devices during deployment. The default way is to use the existing name from the current OS on the device. If the existing name cannot be found it defaults to a randomly generated name. The other options you have are to name based on a WMI query on the local machine, or to use a prefix with randomly generated characters. These options can be accessed by clicking Advanced on the welcome page of the Deploy Wizard.

Thanks,

Erik

Link to comment
Share on other sites

Hello Erik,

Thanks for your reply.

Can i force (unattended) in any way that when i deploy a system, SmartDeploy asks me for a name even when there is a existing name present?

Kind regards,

Dewin

Hello Dewin,

SmartDeploy offers a number of ways to name target devices during deployment. The default way is to use the existing name from the current OS on the device. If the existing name cannot be found it defaults to a randomly generated name. The other options you have are to name based on a WMI query on the local machine, or to use a prefix with randomly generated characters. These options can be accessed by clicking Advanced on the welcome page of the Deploy Wizard.

Thanks,

Erik

Link to comment
Share on other sites

Hello Erik,

Thanks for your reply.

Can i force (unattended) in any way that when i deploy a system, SmartDeploy asks me for a name even when there is a existing name present?

Kind regards,

Dewin

Hello Dewin,

Out of the box SmartDeploy will fail back to defaults if the naming is missing from the answer file. To get this to work you could run a script to delete the computer name section from the answer file that is passed to sysprep by SmartDeploy. This would then prompt the user or administrator setting up the machine for a computer name during Windows Welcome. All other screens of Windows Welcome would still be skipped and filled with the information you provided during the Deploy Wizard or in the answer file.

The code below can delete the computer name form the answer file passed to sysprep. You will need to setup a post image task from the advanced options of Deploy Wizard. This is found by selecting Advanced on the welcome screen for Deploy Wizard. You can then create a task to call the VBScript which will delete the computer name. The script will need to be available to Deploy Wizard during deployment (either on the boot media, in the image or in the same directory as you image if deploying over the network).

For Windows 7

UpdateXML "T:\windows\system32\sysprep\unattend.xml"
UpdateXML "T:\windows\panther\unattend.xml"

Sub UpdateXML(StrFileName)

	Set xmlDoc = CreateObject("Msxml2.DOMDocument.6.0")

	xmlDoc.Async = "False"
	xmlDoc.Load(strFileName)

	xmldoc.setProperty "SelectionNamespaces", "xmlns:bk='urn:schemas-microsoft-com:unattend'"
	set objnode = xmlDoc.selectsingleNode("//bk:ComputerName")


			objnode.parentnode.removechild(objnode)

	xmlDoc.Save(strfilename)

End Sub

For Windows XP

UpdateINI "C:\Sysprep\Sysprep.inf", "UserData", "ComputerName", ""

Sub UpdateINI(strFilename, strSection, strKey, strValue)

	If Not blnDebug Then On Error Resume Next
	Dim fso, f1, strINIContents, strOldSectionContent, strNewSectionContent, intSectionStart, intSectionEnd, blnKeyFound
	Const ForReading = 1
	Const ForWriting = 2
	blnKeyFound = False
	Set fso = CreateObject("Scripting.FileSystemObject")
	If fso.FileExists(strFilename) Then
		Set f1 = fso.OpenTextFile(strFilename, ForReading, , -2)
		strINIContents = f1.ReadAll
		f1.Close
	End If
	intSectionStart = InStr(1, strINIContents, "[" &amp; strSection &amp; "]", vbTextCompare)
	If (intSectionStart) Then
		intSectionEnd = InStr(intSectionStart, strINIContents, vbCrLf &amp; "[")
		If intSectionEnd &lt; 1 Then intSectionEnd = Len(strINIContents) + 1
		strOldSectionContent = Mid(strINIContents, intSectionStart, intSectionEnd - intSectionStart)
		strOldSectionContent = Split(strOldSectionContent, vbCrLf)
		For Each Line In strOldSectionContent
			If UCase(Left(Trim(Line), Len(strKey))) = UCase(strKey) Then
				blnKeyFound = True
				Line = Left(Line, InStr(1, Line, "=", vbTextCompare) - 1) &amp; "=" &amp; strValue
			End If
			strNewSectionContent = strNewSectionContent &amp; Line &amp; vbCrLf
		Next
		If (blnKeyFound) Then
			strNewSectionContent = Left(strNewSectionContent, Len(strNewSectionContent) - 2)
		Else
			strNewSectionContent = strNewSectionContent &amp; strKey &amp; "=" &amp; strValue
		End If
		strINIContents = Left(strINIContents, intSectionStart - 1) &amp; strNewSectionContent &amp; Mid(strINIContents, intSectionEnd)
	Else
	    If Right(strINIContents, 1) &lt;&gt; vbCrLf And Len(strINIContents) &gt; 0 Then 
	    	strINIContents = strINIContents &amp; vbCrLf 
    	End If
    	strINIContents = strINIContents &amp; "[" &amp; strSection &amp; "]" &amp; vbCrLf &amp; strKey &amp; "=" &amp; strValue
	End If
	Set f1 = fso.OpenTextFile(strFilename, ForWriting, True)
	f1.Write strINIContents
	f1.Close

End Sub

Let me know if you have any problems with this,

Erik

Link to comment
Share on other sites

  • 3 years later...

Good Day,

I know this is an old post but I did find a simple workaround for this.

Except the default naming convention and select " Joining Domain" Plug in your domain credentials.

Save your XML as Unattended and export to a Jump Drive.

Open XML and scroll down to the computer naming section and look for the domain input to join the domain.

Remove the domain name and save your XML.

When you boot a machine and it starts the unattend, it will halt since there was a skip put in to join a domain which it can't since there is no domain info present. Now you can add your computer name and the domain to join.

I also edited the XML to have the Welcome screen come up. This gives me the option to backup migration if needed and I edited the image area so it stops there and allows me to pick an image to install

Hope it helps.

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

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

Guest
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.

 Share

×
×
  • Create New...