Deployment Solution

 View Only
  • 1.  How to access the computername variable via command line?

    Posted Jul 01, 2008 08:20 AM
    Hi all, From what I've been told, a name can be applied to a new computer image by renaming the computer object (default name of serial number) in the console, then dropping an image job on that object. Sysprep then picks up the name from the console, and applies it, correct? My real question is, where is this value stored? Is there a variable name that can be accessed during the WinPE runtime (PXE boot)? I see from issuing a SET command in the the command window that there is a value called computername that by default is MINWINPC. If I change the name in the console and reboot the WinPE, this value doesn't change. I don't any other variable in the list containing the value I assigned either. I would like to be able grab this value during runtime and use it in an assignment. Any ideas? Thanks in advance!


  • 2.  RE: How to access the computername variable via command line?

    Posted Jul 01, 2008 09:29 PM
    I am not sure if u are able to use the variables in the command line. However, I know they are tokens. I think there is a token replacement document or juice article or kb.altiris.com --Nelo


  • 3.  RE: How to access the computername variable via command line?

    Posted Jul 01, 2008 10:38 PM
    I know that if you open a command prompt and type: echo %computername% it will show the computer's current name. Try this link for the name change: http://www.fpschultze.de/smartfaq+faq.faqid+64.htm


  • 4.  RE: How to access the computername variable via command line?

    Posted Jul 02, 2008 09:03 AM
    just use this commandline in a DS-script to set the variable on the client: set computername=%NAME% NAME MUST be in uppercases.


  • 5.  RE: How to access the computername variable via command line?

    Posted Jul 02, 2008 05:18 PM
    Thanks for all the great feedback guys. At this point, I feel I need to elaborate more however. The problem is not in *setting* the computername. That's being handled by an existing scripted process in all of the images in our stockpile. The whole problem is, to recycle our current stockpile of images, the computername must be supplied on the front end in order for the remainder of the scripted build process to work. Formerly, this was done by a batch menu running inside of a WinPE. That required mounting the image, waiting for WinPE (we all know how slow that is), and then stepping through the choices. The way I have RDP setup now to use the images, if I just had a way to supply the computername at the beginning and pass it through to the existing script, I'd be golden. I know that naming the console works if using Altiris' sysprep process, but our images have already been sysprepped. Altris *must* be storing the computername value somewhere, and making it accessible to sysprep. I just need to know how to get at it. Does that make sense?


  • 6.  RE: How to access the computername variable via command line?

    Posted Jul 08, 2008 07:28 AM
    Why not change your script slightly to use a token in your DS Job. This should be similar to the way that DS is able to generate the sysprep file. https://kb.altiris.com/display/1/articleDirect/index.asp?aid=18118&r=0.8333399 Will give you all the avaliable tockens. I think you're looking for %compname% though. Hope this helps. Craig


  • 7.  RE: How to access the computername variable via command line?

    Posted Jul 11, 2008 04:28 PM
    Thanks for the suggestion Craig. That sounds easy enough, if you know how to do that. Unfortuantely, I haven't had any training in the scripting language for Altiris, and I haven't the slightest idea where to begin.


  • 8.  RE: How to access the computername variable via command line?

    Posted Jul 12, 2008 08:00 PM
    Can you post a snipit of the script you're trying to run? I'll repost with some examples. Craig


  • 9.  RE: How to access the computername variable via command line?

    Posted Jul 14, 2008 05:28 PM
    Thanks Craig, that will be very helpful! The following VB script is used to get the serial number of the hardward that the image is being deployed to. That serial number is then used to generate a batch file by the same name (to ensure uniqueness).
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
    Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
    
    For Each objItem In colItems
      WScript.Echo "SET MODEL=" & objItem.Model
    Next
    
    For each objBIOS in colBIOS
      WScript.Echo "SET SERIAL=" & objBIOS.SerialNumber
    Next
    
    
    The batch file created with the serial number will be appended to include the requested server name insdie the text body, so that the requested name will perist through reboots. That name is then gleaned and applied to the newly imaged server using the following batch script:
    echo Servername = %NEWNAME%
    netdom renamecomputer %computername% /Newname:%NEWNAME% /FORCE
    set CODE=%errorlevel%
    if not %CODE%==0 goto RENFAIL
    goto end
    
    
    Please keep in mind that this works for out old manual process in which the image process is started by a manually mounted WinPE that has a menu which asks for the server name (among other things) upfront. What I'm hoping to do now is to pass the computername value from the Altiris console through to the same unique batch that contains the server name, so that it will still get picked up by the renaming script (above) that is embedded in the image. Problem is, I just don't know how to ask Altiris for that computer name value.