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
Solved

Windows XP Pro. WSH Startup script

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
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…
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.

792 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