adz Posted October 16, 2014 Report post Posted October 16, 2014 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. Quote Share this post Link to post Share on other sites More sharing options...
tsfahmed2 Posted November 12, 2014 Report post Posted November 12, 2014 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. Quote Share this post Link to post Share on other sites More sharing options...
Alejandro Suarez Posted March 20, 2018 Report post Posted March 20, 2018 did you get the answer? i have the same problem Quote Share this post Link to post Share on other sites More sharing options...