Solved

Windows XP Pro. WSH Startup script

Posted on 2007-03-28
2
779 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

763 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

7 Experts available now in Live!

Get 1:1 Help Now