Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Change WMI propertie value does not work

2 views
Skip to first unread message

Fernando P. Moraes

unread,
Nov 22, 2003, 12:52:35 PM11/22/03
to
Hi,

I Need to change the ForegroundApplicationBoost and LargeSystemCache
properties of the WMI Win32_OperatingSystem class.
I've worte this script, but it does not work ! Anyone knows why ???

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objNetworkSettings = objWMIService.Get("Win32_OperatingSystem")
objNetworkSettings.ForegroundApplicationBoost(1)
bjNetworkSettings.LargeSystemCache(1)

A similar script (below) to change the TCPMaxDataRetransmissions value works
!!!

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")Set objNetworkSettings =
objWMIService.Get("Win32_NetworkAdapterConfiguration")objNetworkSettings.Set
TCPMaxDataRetransmissions(10)


Michael Harris (MVP)

unread,
Nov 22, 2003, 1:35:38 PM11/22/03
to
Fernando P. Moraes wrote:
> Hi,
>
> I Need to change the ForegroundApplicationBoost and LargeSystemCache
> properties of the WMI Win32_OperatingSystem class.
> I've worte this script, but it does not work ! Anyone knows why ???
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> "\root\cimv2") Set objNetworkSettings =
> objWMIService.Get("Win32_OperatingSystem")
> objNetworkSettings.ForegroundApplicationBoost(1)
> bjNetworkSettings.LargeSystemCache(1)


You are accessing these as if they were methods. Both are documented as
*properties*. Note that LargeSystemCache is XP or higher.


>
> A similar script (below) to change the TCPMaxDataRetransmissions
> value works !!!
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> "\root\cimv2")Set objNetworkSettings =
>
objWMIService.Get("Win32_NetworkAdapterConfiguration")objNetworkSettings.Set
> TCPMaxDataRetransmissions(10)

--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

Fernando P. Moraes

unread,
Nov 22, 2003, 6:15:10 PM11/22/03
to
Is the script correct now ???
Is seems to not be working !!
Where am I mistaking ?
(sorry for the bad English)

Take a look:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select ForegroundApplicationBoost
from Win32_OperatingSystem",,48)
For Each objItem in colItems
objItem.ForegroundApplicationBoost = 0
Next

"Michael Harris (MVP)" <mik...@mvps.org> escreveu na mensagem
news:uvqCddSs...@TK2MSFTNGP10.phx.gbl...

Patrick J. LoPresti

unread,
Nov 22, 2003, 5:40:03 PM11/22/03
to Fernando P. Moraes
You need to call objItem.Put_() in each loop iteration to commit your
changes. See:

<http://msdn.microsoft.com/library/en-us/wmisdk/wmi/swbemobject.asp>
<http://msdn.microsoft.com/library/en-us/wmisdk/wmi/swbemobject_put_.asp>

- Pat

Fernando P. Moraes

unread,
Nov 22, 2003, 11:00:48 PM11/22/03
to
This script os still not working, and I do not have Ideal why, look:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select LargeSystemCache from


Win32_OperatingSystem",,48)
For Each objItem in colItems

objItem.LargeSystemCache = 0
objItem.put_()
Next

Anyone can help ?


"Patrick J. LoPresti" <pa...@users.sourceforge.net> wrote in message
news:s5gu14wf2rr.fsf@patl=users.sf.net...

Patrick J. LoPresti

unread,
Nov 23, 2003, 10:14:22 AM11/23/03
to Fernando P. Moraes
Ah, I see now. You are only Selecting the LargeSystemCache property,
which means the object you have is not a complete
Win32_OperatingSystem object. So you cannot invoke Put_ on it.

This will work (I just tried it):

Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

But it is inferior to:

Set colItems = objWMIService.InstancesOf("Win32_OperatingSystem")

Good luck!

Fernando P. Moraes

unread,
Nov 23, 2003, 1:12:09 PM11/23/03
to
Thank You very much, It is working now !

"Patrick J. LoPresti" <pa...@users.sourceforge.net> wrote in message

news:s5gislb86ih.fsf@patl=users.sf.net...

0 new messages