06/18/2014 2062 views
So I've been using the built in K2000 Get and Set computer name scripts and generally they work well. However if the imaging process fails and needs to be reran the name of the machine is lost. This is especially bad in my case since I have to image multiple labs.

Is there any way to have the name of the machine not get lost in case the imaging process fails and needs to be restarted?

0 Comments   [ + ] Show comments


All Answers

the built in get script writes to X:  which is the ram drive in memory.  so a reboot- kiss that good bye

Set compNameFile = fso.CreateTextFile("X:\" & macAddress, True)

you would need to create a modifed get set pair of scripts that go to a mapped drive instead to keep this info.  I use windows shares to deploy my wims so I could write to the same share as the wims are stored. 
Answered 06/18/2014 by: SMal.tmcc
Red Belt

  • if you do this:
    if you have to rerun a machine you only need to use the apply computer name part, otherwise the get name would put garbage data in that folder.
  • Thanks. I ended up saving to the T:\ drive and checking if the file already existed.

    Here were my changes to the GetComputerName.vbs file

    'Dump the computer name into a file named as the mac address inside X:
    If fso.DriveExists("T:") then
    'Get mac adress
    Set objSysEnv = wshShell.Environment("PROCESS")
    macAddress = objSysEnv("MAC_ADDRESS")

    If fso.FileExists("T:\" & macAddress) Then
    Set compNameFile = fso.CreateTextFile("T:\" & macAddress, True)
    End If

    usbDrive = fso.GetDriveName(wscript.ScriptFullName)
    Set compNameFile = fso.CreateTextFile(usbDrive & "\KACE\ComputerName", True)
    End If

    And the only thing I changed in the ApplyComputerName.vbs was the drive it looked for from X:\ to T:\