|
Hello,
for the mass storage device type "win32_diskdrive" a new field is available.
Since WinXP the field "Signature" was added. This field contains the HD Serial Number (do not confuse this with the Volume ID of the partitions). It's the real hardware vendor serial number.
for more informations:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_diskdrive.asp
bye Saxony
|
|
|
|
|
The script looks very useful, thank you! The xslt stylesheet however was not included as indicated in the article. It's easy enough to produce one, I just thought you would like to know.
-Joel
|
|
|
|
|
Oops! Thanks for posting - I've just missed the sheet when composing a new release.
Stylesheet will be uploaded soon, sorry for inconvenience.
Don't worry, be happy )
|
|
|
|
|
Source code updated - now with stylesheet.
Don't worry, be happy )
|
|
|
|
|
I've added this function to add information I need about services and starting parameters. Maybe someone else is interested...
function gatherServicesInfo()
{
var fc = new Enumerator(runQuery("Win32_Service"));
var xmlDoc = null;
var colItem = null;
var numItems = 0;
for ( ; !fc.atEnd(); fc.moveNext())
{
numItems++;
}
if(numItems > 0)
{
xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
colItem = xmlDoc.createElement("Item");
xmlAttachChildToParent(xmlDoc, colItem);
xmlSetAttribute(xmlDoc, colItem, "name", "Service");
var i = 1;
for (fc.moveFirst(); !fc.atEnd(); fc.moveNext())
{
var Obj = fc.item();
var root, num = "";
if(colItem != null)
{
root = xmlDoc.createElement("Element");
num = " " + String(i);
}
else
{
root = xmlDoc.createElement("Item");
}
xmlSetAttribute(xmlDoc, root, "name", "Service " + num);
if(colItem != null)
{
xmlAttachChildToParent(colItem, root);
}
else
{
xmlAttachChildToParent(xmlDoc, root);
}
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "Name", Obj.Name, "name", "Service name");
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "Description",Obj.Description, "name", "Description");
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "PathName", Obj.PathName, "name", "Start Path");
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "ServiceType",Obj.ServiceType, "name", "Service type");
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "State", Obj.State, "name", "Actual state");
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "Status", Obj.Status, "name", "Actual status");
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "StartMode", Obj.StartMode, "name", "Start mode");
xmlCreateChildTextNodeWithAttribute( xmlDoc, root, "StartName", Obj.StartName, "name", "Start name");
i++;
}
}
return xmlDoc;
}
|
|
|
|
|
My first task when creating the script was to create a set of WMI classes useful for periodically (within several days) taking a snapshot of a system(s). That is why, for example, Win32_Fan was not included in Cooling Devices section.
Win32_Services, like any other, rather dynamic, class is useful for constant (several minutes interval) PC health monitoring.
Don't worry, be happy )
|
|
|
|
|
Also mine, but I have a filter that trap and exclude 'normal' services and alerts for 'strange' ones.
Also I'me building a console that (via MSMQ) receive a dump at every startup and verify data with the previous one to identify changes and problems (And also newly installed services). I'll add to this list also the list of running process (like in task manager) to be informed about network evolution..
Bye.
|
|
|
|
|
Is there any way to give domain, user and password for remote computers ?
I'm interested in collecting information from PC into the domain and I have a administrative password for all.
Now on line 250 I got an access error..
TIA.
|
|
|
|
|
Hi Davide,
there is a way, please look at Gotchas\Remote Connections section of the article. There is the code; however, it wasn't included into the script 'cause I couldn't test it.
Dmitry.
|
|
|
|
|
|
Very strange. To date, I've noticed the only bug: when running wmiadmin from a directory, whose name contains spaces (for example, C:\Documents and Settings\Dima\) script sometimes fails to create the output file. I guess it is a bug in older versions of Windows Scripting Host.
Anyway, if you wish to supress all output, you can use 'silent' switch. Running
'wmiadmin.js silent xxx.xxx.xxx.xxx'
just creates the file.
|
|
|
|
|
You cannot use path or filename with spaces.... just add the line below..
var Path = WScript.ScriptFullName;
Path = Path.substring(0, Path.lastIndexOf("\\"));
Path.replace( " ", "%20") // <<< Add this
Hope this help.
|
|
|
|
|
Hello;
How can i backup drivers using WMI ?
can someone give me an example in c#
thank's in advance.
|
|
|
|
|
function gatherProcessorInfo()
{
var fc = new Enumerator(runQuery("Win32_Processor"));
var xmlDoc = null;
var colItem = null;
var numItems = 0;
for (; !fc.atEnd(); fc.moveNext())
{
numItems++;
}
fc.moveFirst();
if(numItems > 0)
{
xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
if(numItems > 1)
{
colItem = xmlDoc.createElement("Item");
xmlAttachChildToParent(xmlDoc, colItem);
xmlSetAttribute(xmlDoc, colItem, "name", "Processors");
}
var i = 1;
for (; !fc.atEnd(); fc.moveNext())
{
var Obj = fc.item();
var root, num = "";
if(colItem != null)
{
root = xmlDoc.createElement("Element");
num = " " + String(i);
}
else
{
root = xmlDoc.createElement("Item");
}
xmlSetAttribute(xmlDoc, root, "name", "Processor" + num);
if(colItem != null)
{
xmlAttachChildToParent(colItem, root);
}
else
{
xmlAttachChildToParent(xmlDoc, root);
}
xmlCreateChildTextNode(xmlDoc, root, "Architecture", Obj.Architecture);
xmlCreateChildTextNode(xmlDoc, root, "Availability", translate_availability(Obj.Availability));
xmlCreateChildTextNode(xmlDoc, root, "Caption", Obj.Caption);
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "CpuStatus", Obj.CpuStatus, "name", "CPU status");
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "CurrentClockSpeed", Obj.CurrentClockSpeed, "name", "Current clock speed");
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "CurrentVoltage", Obj.CurrentVoltage, "name", "Current voltage");
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "DeviceID", Obj.DeviceID, "name", "Device ID");
xmlCreateChildTextNode(xmlDoc, root, "Family", Obj.Family);
xmlCreateChildTextNode(xmlDoc, root, "Manufacturer", Obj.Manufacturer);
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "MaxClockSpeed", Obj.MaxClockSpeed, "name", "Maximum clock speed");
xmlCreateChildTextNode(xmlDoc, root, "Name", Obj.Name);
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "ProcessorId", Obj.ProcessorId, "name", "Processor ID");
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "ProcessorType", Obj.ProcessorType, "name", "Processor type");
xmlCreateChildTextNode(xmlDoc, root, "Revision", Obj.Revision);
xmlCreateChildTextNode(xmlDoc, root, "Role", Obj.Role);
xmlCreateChildTextNodeWithAttribute(xmlDoc, root, "SocketDesignation", Obj.SocketDesignation, "name", "Socket type");
xmlCreateChildTextNode(xmlDoc, root, "Status", Obj.Status);
xmlCreateChildTextNode(xmlDoc, root, "Version", Obj.Version);
i++;
}
}
return xmlDoc;
}
-- modified at 6:29 Thursday 19th January, 2006
|
|
|
|
|
Ok. It works fine.
Thanks a lot, Dmitry.
|
|
|
|
|
Hi everyone!
glucks & hasherfrog - thank you guys for comments. All errors are really withing the gatherProsessorInfo() (probably when running the script on a multiprocessor or HyperThreading-enabled machine). The correct routine 'll be in the next post.
|
|
|
|
|
Yes, some error is occured in gatherProcessorInfo();
Great job. Very useful for admins :]
|
|
|
|
|
Hi,
great Article!
However i've got an error using the script on local computer (XP pro SP2).
"
Windows Script Host
Script: E:\tmp\wmiadmin.js
Line: 144
Char: 3
Error: Only one top level element is allowed in an XML document.
Code: 80004005
Source: msxml3.dll
"
This is the function "xmlAttachChildToParent(parent, child)".
The output file "result-127-0-0-1.xml" is empty (0 Bytes).
Do you have any Idea how i can make it work?
I have admin privileges on local machine.
Regards,
glucks

|
|
|
|
|
Nice to have all the object available, too
|
|
|
|
|