locked
Setting computer name based on model number through vbs script RRS feed

  • Question

  • Hello,  I was trying to set the computer naming convention based on the model number and am not having much luck. I use a similar vbs script to set the task sequence id based on model number which works fine. Here are the customsetting.ini and script I made. I am thinking the problem is with the syntax that i am adding to the customsettings.ini or the function in the vbs script. I have tested the naming conventions and they work fine when i just use one or the other but when i have the script decide which one to use it fails. Any help would be greatly appreciated.

    SetOSDcomputername.vbs :

    Function UserExit(sType, sWhen, sDetail, bSkip)
    	UserExit = Success
    End Function
    
    Function SetOSDComputername(vModel)
    		oLogging.CreateEntry "UserExit - Determining ComputerName - Sequence to run based on Model", LogTypeInfo
    	Select Case vModel
    		Case "20EM001MUS"  
    			SetOSDComputername = "#Mid(Replace("%UUID%","-",""),14,15)#"
    			oLogging.CreateEntry "UserExit - Model = " & VModel & " - Naming UUID", LogTypeInfo
    		Case Else
    			SetOSDComputername = "#Mid(Replace("%UUID%","-",""),11,10) & Right(Replace("%macaddress001%A",":",""),5)#"
    			oLogging.CreateEntry "UserExit - Model = " & vModel & " - Naming 10 UUID 4 MAC A", LogTypeInfo
    	End Select
    End Function


    Customsettings.ini :

    [Default]
    OSInstall=Y
    SkipCapture=YES
    SkipAdminPassword=YES
    SkipApplications=YES
    SkipProductKey=YES
    SkipComputerBackup=YES
    SkipBitLocker=YES
    SkipBDDWelcome=YES
    UserExit=SetTaskSequence.vbs
    TaskSequenceID=#SetTaskSequence("%MODEL%")#
    SkipBuild=YES
    _SMSTSORGNAME=**********
    _SMSTSPackageName=Windows Installation
    SkipFinalSummary=YES
    SkipSummary=YES
    SkipUserData=YES
    DeploymentType=NEWCOMPUTER
    SkipDeploymentType=YES
    SkipTimeZone=YES
    SkipLocaleSelection=YES
    SkipComputerName=YES
    SkipDomainMembership=YES
    UserLocale=en-US
    UILanguage=en-US
    KeyboardLocale=en-US
    UserExit=SetOSDComputername.vbs
    OSDComputername=#SetOSDComputername("%MODEL%")#
    FinishAction=RESTART
    EventService=********
    WSUSServer=*********
    HideShell=YES


    Tuesday, February 21, 2017 9:59 PM

All replies