A newbie here! I have merged many example scripts into one that I can run from a command prompt. The script asks to enter a computer name to search for on the network and uses WMI to get general info on the computer (OS version, IP info, disk info, etc) and it display this info in the dos window.

My question is: How can I add code to have it write this info to a text file that I can store and/or print out? I've tried simply redirecting at command prompt, but that doesn't work.

Background: My intension isn't to have every PC write this info upon booting. When I need the info, it will be nice to just run the script and get it.

Here is the script. Thanks in advance. Any other pointers / suggestions are welcomed.

===========================================================================================
;
; Script Information
;
; Title:
; Author:
; Description:
;
;
; ===========================================================================================
? "Enter computer name: " Gets $Computer
$WMI = GetObject ("winmgmts:\\" + $Computer + "\root\cimv2")
$Win32_OS = $WMI.InstancesOf ("Win32_OperatingSystem")

For Each $Item in $win32_OS
? "Computer Name is: " + $Item.CSName
? "Operating System is: " + $Item.Caption
? "Service Pack Levelis: " + $Item.CSDVersion
? "Install Date is: " + $Item.InstallDate
? "Last Bootup Time was: " + $Item.LastBootUpTime
? "Local Date - Time is: " + $Item.LocalDateTime
? "OS Language Number is: " + $Item.OSLanguage
? "Registered User is: " + $Item.RegisteredUser
? "Registered Company is: " + $Item.Organization
Next
? "Free Space on " $Computer ": "(GetDiskSpace("\\" + $Computer + "\C$$") / 1024) "mb"
$WMI = GetObject("winmgmts:\\" + $Computer + "\root\cimv2")
$HardDrives = $WMI.ExecQuery("Select * from Win32_LogicalDisk
Where DriveType=3")
For Each $Drive in $HardDrives
? "Drive Letter: " $Drive.Name
? "Drive Space: " $Drive.Size
? "Drive Free Space: " $Drive.FreeSpace
Next
If MemorySize() < 247
? $Computer + " is using a machine with far to little memory. Please add it to the list of computers requiring upgrades."
EndIf
If MemorySize() > 248
? $Computer + " has enough memory."
EndIf
$WMI = GetObject("winmgmts:\\" + $Computer + "\root\cimv2")
$Items = $WMI.ExecQuery("Select * from
Win32_LogicalMemoryConfiguration",,48)
For Each $Item in $Items
? "Total Physical Memory: " $Item.TotalPhysicalMemory " KB"
Next
$WMI = GetObject ("winmgmts:\\" + $Computer + "\root\cimv2")
$NICs = $WMI.ExecQuery ("Select * from
Win32_NetworkAdapterConfiguration",,48)
For Each $NICInfo in $NICs
?
For Each $Detail in $NICinfo.IPAddress
? "IP Address: " + $Detail
Next
For Each $Detail in $NICinfo.IPSubnet
? "IP Subnet: " + $Detail
Next
For Each $Detail in $NICinfo.DefaultIPGateway
? "Default IP Gateway: " + $Detail
Next
Next