Go Back   TechArena Community > Technology > Technology & Internet
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Sponsored Links


creating a script for a host file

Technology & Internet


Reply
 
Thread Tools Search this Thread
  #1  
Old 07-07-2010
Member
 
Join Date: Jul 2010
Posts: 1
creating a script for a host file

Sponsored Links
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!

Reply With Quote
  #2  
Old 07-07-2010
Gusgr8's Avatar
Member
 
Join Date: Jun 2006
Posts: 612
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.
Reply With Quote
Reply

  TechArena Community > Technology > Technology & Internet


Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 08:35 AM.