This is a multi-part message in MIME format.

------=_NextPart_000_001E_01C518E0.F73DA380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

The following script runs ok on Win2k/Xp, however, failed on NT, have =
not tested on Win9x. Can anyone give me some hints who should I write =
this to support NT/win9X.
Anyway, the script is just to query RAM, server tag, information only.

Thanks,
Frank

On Error Resume Next
Const wbemFlagReturnImmediately =3D &h10
Const wbemFlagForwardOnly =3D &h20
Const CONVERSION_FACTOR =3D 1048576

' specify the computer in the array.
arrComputers =3D Array("127.0.0.1")
For Each strComputer In arrComputers
Set objWMIService =3D GetObject("winmgmts:\\" & strComputer & =
"\root\CIMV2")
' to get computer name, model, logon user, totol memory, etc.
Set colItems =3D objWMIService.ExecQuery("SELECT * FROM =
Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + =
wbemFlagForwardOnly)
For Each objItem In colItems
strModel =3D objItem.Model
StrComputerName =3D objItem.Name
StrTotolPhysicalMemory =3D objItem.TotalPhysicalMemory
strUserName =3D objItem.UserName
Next

' to get the service tag,
Set objWMIService =3D GetObject("winmgmts:" _
& "{impersonationLevel=3Dimpersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSMBIOS =3D objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
strServiceTag =3D objSMBIOS.SerialNumber
Next=20
' output the value =20
WScript.Echo
WScript.Echo =
"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
WScript.Echo "Computer Name: " & StrComputerName
WScript.Echo "Service Tag: " & strServiceTag
WScript.Echo "Hardware Model: " & strModel
WScript.Echo "Logon User: " & strUserName
WScript.Echo "Total Physical Memory: " & Int(StrTotolPhysicalMemory =
/CONVERSION_FACTOR) & "M"
WScript.Echo =
"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"
=20
' to get the Physical Memeory infomation
Set colItems =3D objWMIService.ExecQuery("SELECT * FROM =
Win32_PhysicalMemory", "WQL", _
wbemFlagReturnImmediately + =
wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "Tag: " & objItem.Tag
WScript.Echo "Capacity: " & objItem.Capacity / CONVERSION_FACTOR & =
"M"
WScript.Echo "DeviceLocator: " & objItem.DeviceLocator
WScript.Echo "MemoryType: " & objItem.MemoryType
WScript.Echo "Name: " & objItem.Name
WScript.Echo "PositionInRow: " & objItem.PositionInRow
WScript.Echo "TotalWidth: " & objItem.TotalWidth
WScript.Echo "TypeDetail: " & objItem.TypeDetail
WScript.Echo
Next
Next

Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:=20
WMIDateStringToDate =3D CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & =
Mid(dtmDate,13, 2))
End Function
------=_NextPart_000_001E_01C518E0.F73DA380
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1491" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The following script runs ok on =
Win2k/Xp, however,=20
failed on NT, have not tested on Win9x. Can anyone give me some hints =
who should=20
I write this to support NT/win9X.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Anyway, the script is just to query =
RAM, server=20
tag, information only.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Frank</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>On Error Resume Next<BR>Const=20
wbemFlagReturnImmediately =3D &amp;h10<BR>Const wbemFlagForwardOnly =3D=20
&amp;h20<BR>Const CONVERSION_FACTOR =3D 1048576</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>' specify the computer in the=20
array.<BR>arrComputers =3D Array("127.0.0.1")<BR>For Each strComputer In =

arrComputers<BR>&nbsp;&nbsp;&nbsp; Set objWMIService =3D =
GetObject("winmgmts:\\"=20
&amp; strComputer &amp; "\root\CIMV2")<BR>' to get computer name, model, =
logon=20
user, totol memory, etc.<BR>&nbsp;&nbsp;&nbsp; Set colItems =3D=20
objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL",=20
_<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
wbemFlagReturnImmediately + wbemFlagForwardOnly)<BR>&nbsp;&nbsp;&nbsp; =
For Each=20
objItem In colItems<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strModel =3D=20
objItem.Model<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StrComputerName =3D=20
objItem.Name<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StrTotolPhysicalMemory =
=3D=20
objItem.TotalPhysicalMemory<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
strUserName =3D=20
objItem.UserName<BR>&nbsp;&nbsp;&nbsp; Next</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>' to get the service tag,<BR>&nbsp;Set=20
objWMIService =3D GetObject("winmgmts:" _<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;&amp;=20
"{impersonationLevel=3Dimpersonate}!\\" _<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;&amp;=20
strComputer &amp; "\root\cimv2")<BR>&nbsp;Set colSMBIOS =3D=20
objWMIService.ExecQuery _<BR>&nbsp;&nbsp;&nbsp;&nbsp; ("Select * from=20
Win32_SystemEnclosure")<BR>&nbsp;For Each objSMBIOS in=20
colSMBIOS<BR>&nbsp;&nbsp;strServiceTag =3D=20
objSMBIOS.SerialNumber<BR>&nbsp;&nbsp;&nbsp; Next <BR>' output the=20
value&nbsp;&nbsp;&nbsp;&nbsp; =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
WScript.Echo<BR>&nbsp;&nbsp; &nbsp;WScript.Echo=20
"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"<BR>&nbsp;&nbsp;&n=
bsp;&nbsp;=20
WScript.Echo "Computer Name: " &amp; =
StrComputerName<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;WScript.Echo "Service Tag: " &amp; =
strServiceTag<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;WScript.Echo "Hardware Model: " &amp; =
strModel<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;WScript.Echo "Logon User: " &amp; =
strUserName<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;WScript.Echo "Total Physical Memory: " &amp; =
Int(StrTotolPhysicalMemory=20
/CONVERSION_FACTOR) &amp; "M"<BR>&nbsp;&nbsp;&nbsp; &nbsp;WScript.Echo=20
"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"<BR>&nbsp;&nbsp;&n=
bsp; &nbsp; <BR>'=20
to get the Physical Memeory infomation<BR>&nbsp;Set colItems =3D=20
objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory", "WQL",=20
_<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
wbemFlagReturnImmediately + wbemFlagForwardOnly)<BR>&nbsp;For Each =
objItem In=20
colItems<BR>&nbsp;&nbsp;&nbsp;&nbsp; WScript.Echo "Tag: " &amp;=20
objItem.Tag<BR>&nbsp;&nbsp;&nbsp;&nbsp; WScript.Echo "Capacity: " &amp;=20
objItem.Capacity / CONVERSION_FACTOR &amp; =
"M"<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
WScript.Echo "DeviceLocator: " &amp;=20
objItem.DeviceLocator<BR>&nbsp;&nbsp;&nbsp;&nbsp; WScript.Echo =
"MemoryType: "=20
&amp; objItem.MemoryType<BR>&nbsp;&nbsp;&nbsp;&nbsp; WScript.Echo "Name: =
" &amp;=20
objItem.Name<BR>&nbsp;&nbsp;&nbsp;&nbsp; WScript.Echo "PositionInRow: " =
&amp;=20
objItem.PositionInRow<BR>&nbsp;&nbsp;&nbsp;&nbsp; WScript.Echo =
"TotalWidth: "=20
&amp; objItem.TotalWidth<BR>&nbsp;&nbsp;&nbsp;&nbsp; WScript.Echo =
"TypeDetail: "=20
&amp; objItem.TypeDetail<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
WScript.Echo<BR>&nbsp;&nbsp;&nbsp; Next<BR>Next</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Function=20
WMIDateStringToDate(dtmDate)<BR>WScript.Echo dtm: =
<BR>&nbsp;WMIDateStringToDate=20
=3D CDate(Mid(dtmDate, 5, 2) &amp; "/" &amp; _<BR>&nbsp;Mid(dtmDate, 7, =
2) &amp;=20
"/" &amp; Left(dtmDate, 4) _<BR>&nbsp;&amp; " " &amp; Mid (dtmDate, 9, =
2) &amp;=20
":" &amp; Mid(dtmDate, 11, 2) &amp; ":" &amp; Mid(dtmDate,13, 2))<BR>End =

Function</FONT></DIV></BODY></HTML>

------=_NextPart_000_001E_01C518E0.F73DA380--

Re: Script to run on NT and Win9x by Roland

Roland
Tue Feb 22 00:22:24 CST 2005

: "Frank" wrote in message news:OqajP3JGFHA.444@TK2MSFTNGP15.phx.gbl...
: The following script runs ok on Win2k/Xp, however, failed on NT, have not
tested on Win9x. Can anyone give me some hints
: who should I write this to support NT/win9X.
: Anyway, the script is just to query RAM, server tag, information only.

Please only use plain text on usenet.

"failed on NT" is not enough to go on. You got an error message laying
around there somewhere?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp



Re: Script to run on NT and Win9x by Torgeir

Torgeir
Tue Feb 22 04:45:41 CST 2005

Frank wrote:

> Hi,
>
> The following script runs ok on Win2k/Xp, however, failed on NT,
> have not tested on Win9x. Can anyone give me some hints who should
> I write this to support NT/win9X.
> Anyway, the script is just to query RAM, server tag, information only.
> (snip WMI code)
Hi

You will need to install the WMI Core on NT4 and Win9x computers:

WMI CORE 1.5 for Windows 95/98
http://www.microsoft.com/downloads/release.asp?ReleaseID=18492

WMI CORE 1.5 for Windows NT 4.0
http://www.microsoft.com/downloads/release.asp?ReleaseID=18491


For Win9x, you will need to do some configuration changes to be able to
access it remotely:

Starting the Windows Management Service
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/starting_the_windows_management_service.asp

Automatically Invoking WMI on Windows 95/98
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/automatically_invoking_wmi_on_windows_95_98.asp


From: Jerald R. Rawdon Jr.
Subject: Re: WMI & remote reboot
http://groups.google.co.uk/groups?hl=en&lr=&selm=t8e09is8aaai8f%40corp.supernews.com

- and -

from an earlier posting by Raman:

<quote>
From: Raman \(Microsoft WMI Dev Support\)
Subject: WMI Information Series - [ How to configure Win9x for remote
connections]
Newsgroups: microsoft.public.wbem
Date: 2001-09-24 10:21:40 PST


As part of taking a more pro-active role in community newsgroups, the
wmi developer support group will be posting useful wmi information from
time to time to this newsgroup. This will include things like sample
code, tips, new KB articles and general wmi information.

The following is the first post in this series. Stay tuned for periodic
future posts.

Title : How to configure Win9x for remote connections

To get wmi working on Win9x please do the following steps
1. Set user-level access control
a. Right click on Network Neigborhood and select properties
b. Select 'Access Conrol' tab
c. Choose 'User-level access control'
d. Set 'Obtain list of users and groups from' to approriate Domain

2. Set DCOM permissions
You can either set using the registry or dcomcnfg

Using the registry
a. Start->Run->regedit.exe
b. Goto HKLM\Software\Microsoft\OLE
c. Set EnableDCOM to 'Y'
d. Set EnableRemoteConnect to 'Y'

Using dcomcnfg
a. Start->Run->dcomcnfg.exe
b. Select 'Default Properties Tab'
c. Check 'Enable Distributed COM on this computer'
d. Select 'Default Security Tab'
e. Check 'Enable Remote Connection'

3. Set WMI permissions
a. Goto c:\windows\system\wbem
b. Double click on wbmecntl.exe
c. Select Security Tab
d. Select Root in the namespace list
e. Click on security and add the appropriate users and give them all
permissions

f. Select Advanced Tab
g. Uncheck 'Enable anonymous connection with share level security'
h. Select 'Always auto restart' in the 'Winmgmt process restart' frame


Raman
Microsoft WMI Developer Support

</quote>



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: Script to run on NT and Win9x by Frank

Frank
Tue Feb 22 20:32:25 CST 2005

No specific errror returned, it just output without any contents as below. I
guess it is like what Torgeir said, WinNT/9X need to install WMI Core to
support the query of information.
==========================================
Computer Name:
Service Tag:
Hardware Model:
Logon User:
Total Physical Memory: 0M
==========================================

regards,
Frank


"Roland Hall" <nobody@nowhere> wrote in message
news:u$RrgbKGFHA.3840@tk2msftngp13.phx.gbl...
> : "Frank" wrote in message news:OqajP3JGFHA.444@TK2MSFTNGP15.phx.gbl...
> : The following script runs ok on Win2k/Xp, however, failed on NT, have
not
> tested on Win9x. Can anyone give me some hints
> : who should I write this to support NT/win9X.
> : Anyway, the script is just to query RAM, server tag, information only.
>
> Please only use plain text on usenet.
>
> "failed on NT" is not enough to go on. You got an error message laying
> around there somewhere?
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>



Re: Script to run on NT and Win9x by Al

Al
Tue Feb 22 20:54:03 CST 2005


"Frank" <signup0702@sina.com> wrote in message
news:ufQvQ$UGFHA.1292@TK2MSFTNGP10.phx.gbl...
> No specific errror returned, it just output without any contents as below.
I
> guess it is like what Torgeir said, WinNT/9X need to install WMI Core to
> support the query of information.
> ==========================================
> Computer Name:
> Service Tag:
> Hardware Model:
> Logon User:
> Total Physical Memory: 0M
> ==========================================

Looks to me as if WMI Core is already installed - if it were not, I would
have expected it to throw errors when trying to instantiate an object not
available on the system.

But even once you have the latest version of WMI installed, it will NOT be
able to force weaker O/S to be able to provide your script with information
that the O/S itself does not manage.

/Al

> regards,
> Frank
>
>
> "Roland Hall" <nobody@nowhere> wrote in message
> news:u$RrgbKGFHA.3840@tk2msftngp13.phx.gbl...
> > : "Frank" wrote in message news:OqajP3JGFHA.444@TK2MSFTNGP15.phx.gbl...
> > : The following script runs ok on Win2k/Xp, however, failed on NT, have
> not
> > tested on Win9x. Can anyone give me some hints
> > : who should I write this to support NT/win9X.
> > : Anyway, the script is just to query RAM, server tag, information only.
> >
> > Please only use plain text on usenet.
> >
> > "failed on NT" is not enough to go on. You got an error message laying
> > around there somewhere?
> >
> > --
> > Roland Hall
> > /* This information is distributed in the hope that it will be useful,
but
> > without any warranty; without even the implied warranty of
merchantability
> > or fitness for a particular purpose. */
> > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> > WSH 5.6 Documentation -
> http://msdn.microsoft.com/downloads/list/webdev.asp
> > MSDN Library - http://msdn.microsoft.com/library/default.asp
> >
> >
>
>



Re: Script to run on NT and Win9x by Frank

Frank
Wed Feb 23 02:27:42 CST 2005

Hi,

After installing the WMI core on NT4, I have successfully run the script
againt NT4 from remotely, the output is below: Just to note, previouse
output is also queried remotely from Win2k, that could probably explains why
there is no error returned.

regards,
Frank
==========================================
Computer Name: TESTNT4
Service Tag: 1QNN31S
Hardware Model: PowerEdge 2400
Logon User: xxxxx
Total Physical Memory: 255M
==========================================
Tag: Physical Memory 0
Capacity: 256M
DeviceLocator: DIMM_A
MemoryType: 17
Name: Physical Memory
PositionInRow: 1
TotalWidth: 72
TypeDetail: 128

"Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com> wrote in message
news:%23k$pxLVGFHA.1932@TK2MSFTNGP14.phx.gbl...
>
> "Frank" <signup0702@sina.com> wrote in message
> news:ufQvQ$UGFHA.1292@TK2MSFTNGP10.phx.gbl...
> > No specific errror returned, it just output without any contents as
below.
> I
> > guess it is like what Torgeir said, WinNT/9X need to install WMI Core to
> > support the query of information.
> > ==========================================
> > Computer Name:
> > Service Tag:
> > Hardware Model:
> > Logon User:
> > Total Physical Memory: 0M
> > ==========================================
>
> Looks to me as if WMI Core is already installed - if it were not, I would
> have expected it to throw errors when trying to instantiate an object not
> available on the system.
>
> But even once you have the latest version of WMI installed, it will NOT be
> able to force weaker O/S to be able to provide your script with
information
> that the O/S itself does not manage.
>
> /Al
>
> > regards,
> > Frank
> >
> >
> > "Roland Hall" <nobody@nowhere> wrote in message
> > news:u$RrgbKGFHA.3840@tk2msftngp13.phx.gbl...
> > > : "Frank" wrote in message
news:OqajP3JGFHA.444@TK2MSFTNGP15.phx.gbl...
> > > : The following script runs ok on Win2k/Xp, however, failed on NT,
have
> > not
> > > tested on Win9x. Can anyone give me some hints
> > > : who should I write this to support NT/win9X.
> > > : Anyway, the script is just to query RAM, server tag, information
only.
> > >
> > > Please only use plain text on usenet.
> > >
> > > "failed on NT" is not enough to go on. You got an error message
laying
> > > around there somewhere?
> > >
> > > --
> > > Roland Hall
> > > /* This information is distributed in the hope that it will be useful,
> but
> > > without any warranty; without even the implied warranty of
> merchantability
> > > or fitness for a particular purpose. */
> > > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> > > WSH 5.6 Documentation -
> > http://msdn.microsoft.com/downloads/list/webdev.asp
> > > MSDN Library - http://msdn.microsoft.com/library/default.asp
> > >
> > >
> >
> >
>
>