Skip to content

SCCM + VMWare - Computer naming

Featured Replies

Hi all,


I currently am working on client site, and I've been requested to research the possibility of renaming a VMWare virtual machine computer name using a step in an SCCM 2012 Task Sequence.


The idea is this:


1. Using a script to obtain the MAC address of the virtual machine

2. Once it has the MAC address, using the same or another script to query the VCenter database using PowerCLI or similar to find that MAC address to then find the VM friendly name, to then change the NETBIOS name of the deployed & domain joined machine.


This is all to alleviate having to type in the VMWare virtual machine friendly name, and the NETBIOS name (OSDComputerName)....an attempt in reducing double handling.


I've seen a few scripts floating around on the interwebs, but nothing substantial or overly specific to what I'm looking for.

  • 4 weeks later...

Hi,

I know this is pretty old, but just in case someone needs it:

Dim env
Dim strCPUName

strNewName = "wrongname" 

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery ("Select SerialNumber from Win32_SystemEnclosure") 

For Each objSMBIOS in colSMBIOS 
	strNewName = objSMBIOS.SerialNumber
Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPENABLED = 'True'")
For Each objItem in colItems
	strMAC = Replace(ObjItem.MACAddress, ":","")
	strCPUName = "V" & Right(strMAC,7)
	If Len(strCPUName) > 1 Then
	    	Exit For
	End If
	Next

Set env = CreateObject("Microsoft.SMS.TSEnvironment") 
env("COMPUTERNAME") = strCPUName

after this you'll need to set a Task Sequence variable OSDCOMPUTERNAME to %COMPUTERNAME%

 

thats it. :)

  • 3 years 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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.