Results 1 to 2 of 2

Thread: creating a script for a host file

  1. #1
    Join Date
    Jul 2010
    Posts
    1

    creating a script for a host file

    Hi all,

    I was just given an assignment for a simple task of creating a script for a host file.

    My main goal is to:

    1. specify file in specified directory(host file)

    2. Tell script to write a (11.111.111.111 abc.com) line to the host file

    3. Tell script to save file & overwrite anything if necessary in the specified directory.

    Until now I had no idea what a script was so Im extremely new to this and was wondering if someone can point me in the right direction of what to look for.

    It would be greatly appreciate. Thanks!

  2. #2
    Join Date
    Jun 2006
    Posts
    623

    Re: creating a script for a host file

    Below is a sample script to check your version of WSH and WMI.

    Code:
    'Script to display WSH, VBScript, WMI, and ADSI versions
    'Script created by Guy Thomas
    
    On Error Resume Next
    
    WScript.Echo "WSH Version: " & WScript.Version
    
    Wscript.Echo "VBScript Version: " & ScriptEngineMajorVersion _
    & "." & ScriptEngineMinorVersion
    
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer _
    & "\root\cimv2")
    Set colWMISettings = objWMIService.ExecQuery _
    ("Select * from Win32_WMISetting")
    For Each objWMISetting in colWMISettings
    Wscript.Echo "WMI Version: " & objWMISetting.BuildVersion
    Next
    
    Set objShell = CreateObject("WScript.Shell")
    strAdsiVersion = _
    objShell.RegRead("HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{E92B03AB-B707-11d2-9CBD-0000F87A369E}\Version")
    If strAdsiVersion = vbEmpty Then
    strAdsiVersion = objShell.RegRead("HKLM\SOFTWARE\Microsoft\ADs\Providers\LDAP\")
    If strAdsiVersion = vbEmpty Then
    strAdsiVersion = "ADSI is not installed."
    Else
    strAdsiVersion = "2.0"
    End If
    End If
    WScript.Echo "ADSI Version: " & strAdsiVersion
    Copy the above script into Notepad
    Save with a .vbs extension, e.g. guydemo.vbs.
    Double click to execute.

Similar Threads

  1. How can I Report a Website, File Host or a Web Host?
    By rasnam in forum Technology & Internet
    Replies: 4
    Last Post: 07-06-2011, 06:52 PM
  2. Need help creating a SCRIPT file for navigation buttons
    By Rob Dizzle in forum Software Development
    Replies: 4
    Last Post: 19-01-2010, 04:53 PM
  3. host 'A' record is not creating dynamically in DNS
    By shappy in forum Operating Systems
    Replies: 2
    Last Post: 25-06-2009, 11:45 PM
  4. Windows Script Host Error
    By motasim in forum Operating Systems
    Replies: 1
    Last Post: 13-12-2008, 01:46 PM
  5. Windows script host access disabled...
    By Antonio00 in forum Windows XP Support
    Replies: 3
    Last Post: 19-08-2008, 06:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,540,594.30670 seconds with 16 queries