Windows XP

Using the NETSH command

 
The "netsh" command as many features such as changing firewall settings, bridging connections, changing routing, WINS, DNS, Winsock, ...etc. The list goes on and on. This topic will show you how to do the following:
  • Set static IP
  • Set static WINS
  • Set Static DNS
  • Reset Network configuration
  • Automating the Process
 

Using the netsh command

To use the netsh command, open a command window and type netsh. Your command prompt should then display "netsh>" .

Icons and Icon Creating Software

Free icons and software. High quality and nicely done.

http://www.vistaicons.com/

Block Site in HOST file

$hostfile = "C:\windows\system32\drivers\etc\hosts"
 
;InputBox features: Title=Yes, Prompt=Yes, Default Text=Yes
If Not IsDeclared("sInputBoxAnswer") Then Dim $sInputBoxAnswer
$website = InputBox("Block site","Type in the site you want to block access to?","WWW.SPAM.COM"," ","-1","-1","-1","-1")
Select
   Case @Error = 0 ;OK - The string returned is valid
	   $error = FileWriteLine($hostfile,"127.0.0.1       " & $website)
	   If $error = "0" Then
			MsgBox(16,"Warning!","Couldn't write to file")
		Else

Get MAC

#include <Process.au3>
#include <file.au3>
;AutoItSetOption ( "0", RunErrorsFatal )
Opt("RunErrorsFatal", 0) 
$n1 = 10
$n2 = 20
$n3 = 71
$n4 = 210
$username = "user"
$password = "password"
 
 RunWait(@ComSpec & " /c " & "getmac /S " & $n1 & "."  & $n2 & "."  & $n3 & "."  & $n4 & " /U " &$username & " /p " & $password  &  "> getmac.txt", "", @SW_HIDE)
$rc = Filereadline("getmac.txt",4)
 
MsgBox(0,$n1 & $n2 & $n3 & $n4 ,$rc) 
_FileWriteLog( "Mac.txt", $rc)

Profile Backup

Script copies specified folders. Requires two fies "Extensions.txt" and "Settings.ini"

Settings INI would look like this: 
[ADMINUSERS]
FILE=Adminusers.txt
 
[POWERUSERS]
FILE=PowerUsers.txt

Extensions.txt would look like this:
*.rtf
*.dot
*.xls
*.xlt
*.ppt
*.ppa
*.pps
*.pot
*.pdf
*.ai
*.eps
*.p65
*.t65

#include <File.au3>
Dim $ext, $x
$bkupDir = "f:\" & @ComputerName
$fsource = @UserProfileDir & "\Desktop\"
$fileDest = $bkupDir & "\Documents"
$FavSource = @UserProfileDir & "\Favorites\"
$favDest = $bkupDir & "\Favorites"

Screen Shot Talker

This script came in handy trying to see what the user seen. If the user was too busy to call the help desk and it wasn't critical, they simple did a "print screen" and this script would send an email with a screen shot and some network information for trouble shooting. It uses BLAT for windows: http://www.blat.net/194/

;~ Program will take a screen shot using the DLL called capt.dll and then send it to 
;~ a whomever is listed in the 'settings.ini' file. The settings.ini file also contains

Remotely Enable DNS Registration

Dim $val, $GUID, $i
;~ ;------------------------------------------CODE--------------------------------------------
$regkey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
For $i = 1 to 100
    $var = RegEnumKey($regkey, $i)
    If @error <> 0 then ExitLoop
		$info = RegRead($regkey & "\" & $var, "RegistrationEnabled")
		If $info = "0" Then
			RegWrite($regkey & "\" & $var, "RegistrationEnabled","REG_DWORD","1")
		Else
		EndIf

MS Agent

Script shows an example of how invoke Microsoft Agent and speak.

Dim $objAgent,$objCharacter,$strAgentName,$strAgentPath,$strCmd,$strText
Global $d
$strAgentName = "Merlin"
$strAgentPath = "C:\Windows\Msagent\Chars\" & $strAgentName & ".acs"
$objAgent = ObjCreate("Agent.Control.2")
$objAgent.Connected = 1
$objAgent.Characters.Load ($strAgentName, $strAgentPath)
$objCharacter = $objAgent.Characters.Character($strAgentName)
$objCharacter.Show()
;------------------------------------------------------------------------------
;CODE BELOW

Set USB Ports Read Only

;READ Reg Key
;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies]
;"WriteProtect"=dword:00000001
 
;Read RegKey and then create if it doesn't exsist
$key = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies", "WriteProtect",)
	IF @error = -1 Then
		RegWrite ( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies" ,"WriteProtect", "REG_DWORD", "0" ) 
		MsgBox(0,"WriteProtect", "Registry key has been created")
	EndIf
 
	IF $key = "1" Then

Enable - Disable USB Ports

;----------------------------------------
;Read RegKey and then create if it doesn't exsist
;----------------------------------------
$key = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start",)
	IF @error = -1 Then
		RegWrite ( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" ,"Start", "REG_DWORD", "3" ) 
		MsgBox(0,"Start", "Registry key has been created")
	EndIf
 
	If $key = "4" Then
		MsgBox(0,"USB PORTS", "USB Ports are currently Enabled")
		Elseif $key = "4" Then
		MsgBox(0,"USB PORTS", "USB Ports are currently Disabled")
	EndIf