Re: Writing to a text file




"Joe H" <JoeH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:304F851C-31F0-456E-80D7-EEB62D8E140D@xxxxxxxxxxxxxxxx
With help from the MVP in this forum, I have a script that resets the
local
admin passwords in different OU in my network.

I have figure out a way to make the script print the computer name on the
screen. This works great. Now I want to get fancier and want to print what
I
get on the screen to a text file.

How do I make a script save to a text file in the c drive on my server?

Thanks,

--
Joe H

Have a look here:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept04/hey0914.mspx

The article suggests you use code like this to pick up screen output:
Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec _
("%comspec% /c ping -n 3 -w 1000 192.168.1.1")
Do While Not objExecObject.StdOut.AtEndOfStream
wscript.echo objExecObject.StdOut.ReadAll()
Loop

Instead of using "wscript.echo", write your lines to a text file.
You might also want to download the whole Scripting Guy file -
there is a wealth of information in there!


.



Relevant Pages

  • Re: Map a NetworkShare to another Folder
    ... ...That script you mentioned does not what you want ... network folder on the disk G: and name the shortcut "Abteilungen" ....With a ... Set objShell = WScript.CreateObject ... | I need help for a script, that maps a Network Share to a local folder. ...
    (microsoft.public.windows.server.scripting)
  • Publishing a Custom form: OL2002 sp2
    ... The custom form in question utilizes VB script to print ... once our Exchange admin published the form to the Organization Forms ... my VB script print button ceased working. ...
    (microsoft.public.outlook.program_forms)
  • Re: Writing to a text file
    ... Joe H ... I have figure out a way to make the script print the computer name on ... How do I make a script save to a text file in the c drive on my server? ... Set objShell = CreateObject ...
    (microsoft.public.windows.server.scripting)
  • Re: need Net::AIMTOC help
    ... daniel kaplan wrote: ... > this is my current app, ... Does the script print anything at all? ...
    (comp.lang.perl.modules)
  • Re: Modelling Complex Sentences
    ... re-inventing the network data model). ... If such as classifying node does not exist, ... Since people complained that dbd's scripts were too long, ... you typically use the CREATE/INSERT commands to ...
    (comp.databases.theory)