Unsolved

This post is more than 5 years old

1 Message

19521

September 30th, 2015 17:00

How to set computer name from Asset tag using vbscript?

I got this script to set the computer name from the serial number to use when building a pc with a SCCM task sequence. Our company sets the computer name against the asset tag.

Would anybody be able to tell me how I can modify the following script to use the asset tag?

SET env = CreateObject(“Microsoft.SMS.TSEnvironment”) strComputer=”.” ‘ Connect to WMI Set objWMIService=GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\” &strComputer& “\root\cimv2”) ‘ Find the Service Tag, which will make up the last part of the computer name Set colservicetag=objWMIService.ExecQuery(“Select * from Win32_Bios”) For Each objservicetag in colservicetag strName = objservicetag.serialnumber Next ‘ Set the variable env(“OSDCOMPUTERNAME”) = strName

No Responses!
No Events found!

Top