Solved

Windows XP Pro. WSH Startup script

Posted on 2007-03-28
2
782 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
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

Why spend so long doing email signature updates?

Do you spend loads of your time carrying out email signature updates? Not very interesting are they? Don’t let signature updates get you down. Let Exclaimer Cloud - Signatures for Office 365 make managing email signatures a breeze.

Question has a verified solution.

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

The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now