vinodreddy597

Member
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About vinodreddy597

Profile Information

  • OS
    Windows 7 x64
  1. Hi, Here is my vbscript which checks the computer name and then it'll run the registry key if the first 3 letters of machine code matches. But unfortunately it's not working. Please help me.. '------------------------------ ' Computer name '------------------------------ Dim COMPUTER_NAME Dim oFso, sShell, oShellEnv, target, source Set oFso = CreateObject("Scripting.FileSystemObject") Set oShell = WScript.CreateObject("WScript.Shell") Set oShellEnv = oShell.Environment("Process") COMPUTER_NAME = oShellEnv("ComputerName") 'MsgBox COMPUTER_NAME '------------------------------ ' First Three '------------------------------ Dim FIRST_THREE FIRST_THREE = Mid(COMPUTER_NAME, 1, 3) 'MsgBox FIRST_THREE '------------------------------ ' Get Run Registry '------------------------------ Dim IS_RUN_REGISTRY If FIRST_THREE = "HAC" Then IS_RUN_REGISTRY = true Else IS_RUN_REGISTRY = false End If 'MsgBox "[" & FIRST_THREE & "][" & IS_RUN_REGISTRY & "] " '------------------------------ ' Run Registry if needed '------------------------------ Set regFile = "Genesis.reg" If IS_RUN_REGISTRY Then Set oShell = CreateObject("Wscript.Shell") sRegFile = regFile oShell.Run "regedit.exe /s " & Chr(34) & sRegFile & Chr(34), 0, True End If Edit by Gsm added code box