Jump to content


  • 0
Jaekt

vbscript pcname task sequence - fail on some physical machines

Question

Hi!

I'm having some issues with a .vbscript made for renaming computer during a task sequence.

The issue is that it works for renaming virtual machines, but also a physical HP, the way it's supposed to (name of choosing + last 6 digits of serialnumber). However it fails on a customers physical Lenovo machine.

The Lenovo machine sets the first part of name correctly, but completely ignores the fact that it's supposed to cut the serialnumber to the last 6 digits, meaning sometimes the machinename goes above 15 characters.

The vbscript is run right after formating the disk, as seen on this pic:

post-19636-0-07772600-1379420142_thumb.png


The script is:

-----------------------------------------------------------

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

Name = inputbox("Description here", "Title here",env("_SMSTSMachineName"),400,0)


Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Bios")


strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")

For each objBIOS in colBIOS

serial = objBIOS.SerialNumber

Next


serial = Replace(serial," ","",1,-1)



strNewName = Left(Name,9) & Right(serial,6)


env("OSDComputerName") = strNewName

--------------------------------------------------------------


Picture from successfull rename (log) virtual machine:

post-19636-0-68490600-1379420142_thumb.png


Text from logs:

From the logs you can see the virtual machine successfully set the machinename during the MDT Gather-process.

The task sequence execution engine successfully completed the action (Gather) in the group (Initialization) with exit code 0 Action output: Finished remapping variables. ZTIGather processing completed successfully. Property UserDomain is now = ADMIN Property UserID is now = ConfigMgr-NeXXXX <Message containing password has been suppressed> Process completed with exit code 0 Error executing web service http:/ /OPPXXXXXXXXXXXX/MDTMonitorEvent/PostEvent?uniqueID=&computerName=TEST-d7ea46&messageID=41001&severity=1&stepName=Gather&currentStep=16&totalSteps=156&id=C6FB2A42-B79B-E2AC-BB0C-1A2F2ED7EA46,00:50:56:AA:69:1E&messageZTIGather processing completed successfully.&dartIP=&dartPort=&dartTicket=&vmHost=&vmName=: The operation timed out (-2147012894) Event 41001 sent: ZTIGather processing completed successfully. Command line returned 0 Entering ReleaseSource() for D:\_SMSTaskSequence\Packages\OPS0001A reference count 1 for the source D:\_SMSTaskSequence\Packages\OPS0001A before releasing Delete source directory D:\_SMSTaskSequence\Packages\OPS0001A Released the resolved source D:\_SMSTaskSequence\Packages\OPS0001A.



Picture from "failed" (log) rename Lenovo:

post-19636-0-32361900-1379420141_thumb.jpg

as you can see, there are 11 characters in the serial number


The task sequence execution engine successfully completed the action (Gather) in the group (Initialization) with exit code 0 Action output: shed remapping variables. ZTIGather processing completed successfully. Property UserDomain is now = ADMIN Property UserID is now = ConfigMgr-NeXXXXX <Message containing password has been suppressed> Process completed with exit code 0 Error executing web service http:/ /OPPXXXXXXXXXXXXXX/MDTMonitorEvent/PostEvent?uniqueID=&computerName=USK-COAIN013GYT&messageID=41001&severity=1&stepName=Gather&currentStep=16&totalSteps=156&id=F449XXXXX-XXXX-11E0-9DC4-0XX07F19C838,E4:XX:XX:33:XX:80&messageZTIGather processing completed successfully.&dartIP=&dartPort=&dartTicket=&vmHost=&vmName=: The operation timed out (-2147012894) Event 41001 sent: ZTIGather processing completed successfully. Command line returned 0 Entering ReleaseSource() for D:\_SMSTaskSequence\Packages\OPS0001A reference count 1 for the source D:\_SMSTaskSequence\Packages\OPS0001A before releasing Delete source directory D:\_SMSTaskSequence\Packages\OPS0001A Released the resolved source D:\_SMSTaskSequence\Packages\OPS0001A.




Anyone got any idea what might be wrong?

Thanks in advance! :)

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

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

Guest
Answer this question...

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

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.