Jump to content


aliala

Established Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by aliala

  1. Hello,
    I have trouble getting a VBS script to work in SCCM 2012, this script worked without problems in sccm in 2007.
    It is used when we want to install an operating system to harddrive to be installed to another computer of the same model.

    In Task sequence it runns before "Apply Operating System".

     

    The Command Line:

     

    cscript.exe %deployroot%\scripts\EnterComputerName.vbs

     

    Here is the script:

     

     

    'Code Snippet

    Dim env, objRegEx
    Dim Matches, Match
    Dim strPattern, strInputBox, strReason
    Dim boolLength, boolValid

    Set ProgressUI = CreateObject("Microsoft.SMS.TsProgressUI")
    ProgressUI.CloseProgressDialog

    Set env = CreateObject("Microsoft.SMS.TSEnvironment")
    Set objRegEx = New RegExp


    'Define valid patterns as and character not in (a-z, A-Z, 0-9, or -)
    strPattern = "[^a-zA-Z0-9-]"


    Do
    strReason = ""
    strInputBox = InputBox("Enter desired machine name." & VbCrLf & VbCrLf & "Machine names must be 3-14 characters, and include a-z, 0-9, - ONLY." & VbCrLf & VbCrLf & "Machine name WILL be upper case.","Machine Name")
    ' If strInputBox = "" Then TemplateQuit(0)

    ' Check length - must be less than 15 charatcers
    If Len(strInputBox) <= 14 Then
    boolLength = True
    Else
    strReason = strReason & "Machine name too long. Please choose a name from 3-14 characters in length." & VbCrLf
    boolLength = False
    End If

    ' Check character validity
    boolValid = True
    ' Return all matches for invalid characters
    objRegEx.Global = True
    objRegEx.Pattern = strPattern
    ' Generate collection of matches
    Set Matches = objRegEx.Execute(strInputBox)
    ' Check for matches on invalid characters
    For Each Match In Matches
    strReason = strReason & "Invalid character """ & Match.Value & """ found. Please use only a-z, A-Z, 0-9, and -." & VbCrLf
    boolValid = False
    Next
    If Not (boolLength And boolValid) Then MsgBox "Invalid name """ & strInputBox & """ entered!" & VbCrLf & VbCrLf & strReason,vbCritical+vbOKOnly,"Invalid Name Entered"
    Loop While Not (boolLength And boolValid)


    MsgBox "Computer name set to " & UCase(strInputBox) & ".",vbInformation+vbOKOnly,"Computer Name Set"

    env("OSDComputerName") = UCase(strInputBox)

     

    I hope someone can help me with this.

    Thanks!

    post-21912-0-08222600-1410436316_thumb.png

  2. Hello,

    I have a Windows 7 image that already has two language packs installed on it.
    This I did a sysprep in VMware.
    When I'm about to deploy Windows 7 by sccm 2007 r2 so the installation stops and wants me to select a default language. After I select a language, then the OSD proceed with the installation.
    Is there a script or cmd command which selects automatically the language I should have?

     

    Thanks in advance

     

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