Script database structure to files
Author Nigel Rivett
This again uses dmo to script database objects.
This runs from the client machine - useful if you don't have access to the server file structure.

Just put this code in a .vbs file and run it.This scripts the tables - other objects are similar.
This will place the result files in the folder which contains the .vbs file.

dim svr 
dim db 
Dim tbl 
set svr = createobject("SQLDMO.SQLServer") 
svr.loginsecure = true 
svr.Connect "Myserver\MyInstance" 
Set db = svr.Databases("MyDatabase") 

For Each tbl In db.Tables 
	if tbl.SystemObject = 0 then 
		tbl.script 69, "Tables\" & tbl.Name & ".TAB" 
	end if 

set svr = nothing