Even more scripting fun.

I came up with a VBS script that creates a text file with the computer name as the name of the file. It then writes the time and date to the file so I know when I started maintenance on that computer. As simple as this script is, it took me several days of figuring out how to go about making the script using bits and pieces of what I found online.

DIM fso, MFile
Set objNetwork = CreateObject(“Wscript.Network”)
strComputer = objNetwork.ComputerName

Set fso = CreateObject(“Scripting.FileSystemObject”)
Set MFile = fso.CreateTextFile(strComputer & “.txt”, True)
MFile.WriteLine(“Maintained on “& Date &” at “& Time)
MFile.Close

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s