Demonstration script that retrieves network adapter data from a computer,
Displays that data in a Microsoft Word document, and then saves
Document as c: \ scripts \ word \ testdoc.doc.
CopyCode The Code is as follows: Set objword = Createobject ("word. application ")
Objword. Caption = "test caption"
Objword. Visible = true
Set objdoc = objword. Documents. Add ()
Set objselection = objword. Selection
Objselection. Font. Name = "Arial"
Objselection. Font. size = "18"
Objselection. typetext "network adapter Report"
Objselection. typeparagraph ()
Objselection. Font. size = "14"
Objselection. typetext "" & date ()
Objselection. typeparagraph ()
Objselection. typeparagraph ()
Objselection. Font. size = "10"
Strcomputer = "."
Set ob1_miservice = GetObject ("winmgmts: \" & strcomputer & "\ Root \ cimv2 ")
Set colitems = obw.miservice. execquery _
("Select * From win32_networkadapterconfiguration ")
For each objitem in colitems
Objselection. Font. Bold = true
Objselection. typetext "ARP always source route :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. arpalwayssourceroute
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "ARP use ethersnap :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. arpuseethersnap
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "caption :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. Caption
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "database path :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. databasepath
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "Dead GW Detection Enabled :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. deadgwdetectenabled
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "default IP Gateway :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. defaultipgateway
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "Default TOS :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. defaulttos
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "Default TTL :"
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. defaultttl
Objselection. typeparagraph ()
Objselection. Font. Bold = true
Objselection. typetext "Description :"
Objselection. Font. Bold = true
Objselection. Font. Bold = false
Objselection. typetext "" & objitem. Description
Objselection. typeparagraph ()
Objselection. typeparagraph ()
Next
Objdoc. saveas ("C: \ scripts \ word \ testdoc.doc ")
Objword. Quit