/build/static/layout/Breadcrumb_cap_w.png

Is there a "Get Name" type script for printer IP's for use in the K2000

I've used the "Get Name" and "Set Name" tasks on my K2000 images and it seems to work great.

I was wondering if there was such a thing as a "Get IP" and "Set IP" for printers on images?

I'm upgrading 37 machines in one department and they all have the same type of printer attached, just different IP addresses.

It would be fantastic if there could be some sort of customizable script to carry over whatever data we needed.

For example each of these machines have a soft phone that is installed on their computer. If I could get a script that would carry over the MAC address that is entered for the soft phone and have it input on the machine after the image that would be amazing!

 

Thanks for any help or thoughts.


0 Comments   [ + ] Show comments

Answers (1)

Posted by: SMal.tmcc 11 years ago
Red Belt
2

The get name reads the info from the offline registry of the target registry prior to imaging.  If you know what keys the items you are you can modify this scipt to capture those keys.  You can harvest the VBS file from the K2000 by attaching to it and searching for "get".  Mine is under \\ikbox\peinst\preinstall\8

Set fso = CreateObject("Scripting.FileSystemObject")
Set diskDrives = fso.Drives

regFound = False
'Search through fixed drives (Drivetype = 2) for required registry file.
For Each drive In diskDrives
    If (drive.DriveType = 2) and fso.FileExists(drive.DriveLetter & ":\WINDOWS\System32\Config\SYSTEM") Then
        systemDrive = drive.DriveLetter
        regFound = True
        exit for
    End If
NEXT

'Registry not found
If regFound = False Then
    WScript.Quit
End If

'Get the computer name from the registry
Set wshShell = CreateObject("WScript.Shell")
Set execStatus = wshShell.Exec("reg load HKLM\TEMP_SYSTEM " & systemDrive & ":\WINDOWS\System32\Config\SYSTEM")
'Wait for registry to load completely (max 10 seconds)
count = 0
Do While (count < 10) and execStatus.Status = 0
    WScript.Sleep 1000
    count = count + 1
Loop
If execStatus.Status = 0 Then
    WScript.Quit
End If
regKeyCompName = "HKLM\TEMP_SYSTEM\ControlSet001\Control\ComputerName\ComputerName\ComputerName"
compName = wshShell.RegRead(regKeyCompName)
WshShell.Exec("reg unload HKLM\TEMP_SYSTEM")
WScript.Sleep 1000

'Dump the computer name into a file named as the mac address inside T:
If fso.DriveExists("T:") then
    'Get mac adress
    Set objSysEnv = wshShell.Environment("PROCESS")
    macAddress = objSysEnv("MAC_ADDRESS")
    Set compNameFile = fso.CreateTextFile("T:\" & macAddress, True)
Else
    usbDrive = fso.GetDriveName(wscript.ScriptFullName)
    Set compNameFile = fso.CreateTextFile(usbDrive & "\KACE\ComputerName", True)
End If
compNameFile.WriteLine(compName)
compNameFile.Close


Comments:
  • Great! Glad to know it is possible. Now just have to figure out the proper way to do this for the registry keys I want to pull.

    Thanks again. - AFCUjstrick 11 years ago
  • Looks like I've been using the GetComputerName.exe file from the "Useful Scripts" to set the computer name instead of the default one that is included in the K2000. Not sure how to get the commands out of an exe file. - AFCUjstrick 11 years ago
    • they should be about the same, so go with rewriting the above vbs to work for the keys you want, that at least gives you a starting point, just need to twist for your needs. Just overright the parts in the script that get and store the computer name then the 2 will not step on each other when you use both. - SMal.tmcc 11 years ago
    • The Get/Set tasks function quite a bit differently than the canned get computer name script that comes with the K2. The program references the Windows unattend.xml and injects changes directly into that. - mpace 11 years ago
      • Interesting. Do you have more information on this anywhere? - AFCUjstrick 11 years ago
  • Gotcha. Much appreciated. - AFCUjstrick 11 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ