Solved

Windows XP Pro. WSH Startup script

Posted on 2007-03-28
2
787 Views
Last Modified: 2012-08-13
I need to capture Physical memory of aproximately 200 Windows XP pro machines.  I would like to use a startup script for this.  If the script would collect the Machine name and amount of memory installed then append it to a text file stored on the server would be the ideal way.  I have looked at a few scripts, and I know the variables are available to gather the machine name and amount of memory.  Howver I can't figure out hoe to append it to a text file.
0
Comment
Question by:colonytire
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Expert Comment

by:alandc
ID: 18810654
It sounds like you have most of the script worked out. For issues like this it is better that each machine write a file of it's own named by the machine name.  Otherwise you will have multiple entries for each machine (as each is appended the file gets larger and duplicates are NOT elminated) and you will have problems with the file locking on the server.

Instead have each PC write the file MACHINE_NAME.txt to the local drive then copy it to a server share (overwriting automatically any existing file).  To bring all of them together on the server into one file is a simple and quick command that can be run on demand when needed on the server.

I suggest you ask your question again in a script forum if you desire code samples.
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 250 total points
ID: 18810675
Const ForAppend=8

Dim objFSO:Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim objOutput: Set objOutput=objFSO.OpenTextFile("\\server\share\collection.txt", ForAppend)
Dim objWMI:Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colData = objWMI.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objData in colData
  objOutput.WriteLine objData.Name & "," & objData.TotalPhysicalMemory
Next
objOutput.Close
Set objWMI=Nothing
Set objOutput=Nothing
Set objFSO=Nothing
WScript.Quit
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
An article on effective troubleshooting
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question