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

Amended Object problems setting event log sizes

22 views
Skip to first unread message

J Kalmes

unread,
Dec 23, 2002, 3:59:00 PM12/23/02
to
Got a wierd one here... I'm trying to use a standard script from the
script center and I'm getting an error that makes no sense to me at
all.

When I run the script below (which should set the event log sizes), I
get the following error:

Line:14
Char: 1
Error: An amended object cannot be put unless
WBEM_FLAG_USE_AMENDED_QUALIFIERS is specified
Code: 80041066
Source: SWbemObject

For the short term, how do I do this? We had an admin who left all
our event logs at the default size and I have about 50 servers to
change.

For the long term, what is an "amended object" and why do I need to
worry about it? :)

As always, any help is appreciated.

BTW... this works fine on my XP box, but does NOT work on the W2k
server.

---------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile")
For each objLogfile in colLogFiles
strLogFileName = objLogfile.Name
Set wmiSWbemObject = GetObject _
("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2:" _
& "Win32_NTEventlogFile.Name='" & strLogFileName & "'")
wmiSWbemObject.MaxFileSize = 51183616
wmiSWbemObject.OverwriteOutdated = 14
wmiSWbemObject.Put_
Next

Michael Harris (MVP)

unread,
Dec 24, 2002, 12:24:34 AM12/24/02
to
You'll get a faster answer if you repost the question to
...win32.programmer.wmi.

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US


J Kalmes

unread,
Dec 24, 2002, 7:49:53 AM12/24/02
to
On Mon, 23 Dec 2002 21:24:34 -0800, "Michael Harris \(MVP\)"
<mik...@mvps.org> wrote:

>You'll get a faster answer if you repost the question to
>...win32.programmer.wmi.

Thanks, shall do.

--JwK

J Kalmes

unread,
Dec 24, 2002, 9:54:46 AM12/24/02
to

I actually managed to solve this one myself... Aparently, there's a
flag you have to set to tell it that you know you're updating an
amended property. Most of the flags for the Put method are powers of
two... but not this one (it's 131072).

I haven't figured out why my event log size is an amended property,
since that should only apply to localization (installing language
support other than US English), which we do not do. But, the code
below worked. You can find the flag right after the Put statement if
you're interested.

BTW Michael, your suggestion to post to the win32 group prompted me to
broaden my searching in MSDN where I finally found an article that
hinted at this solution. Thanks again.

--JwK

'----------------------------
'begin script


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile")
For each objLogfile in colLogFiles
strLogFileName = objLogfile.Name
Set wmiSWbemObject = GetObject _

("winmgmts:{impersonationLevel=Impersonate}!\\" & strComputer &


"\root\cimv2:" _
& "Win32_NTEventlogFile.Name='" & strLogFileName & "'")

Wscript.echo "LogFileName: " & strLogFileName
Wscript.echo "MaxFileSize: " & wmiSWbemObject.MaxFileSize
Wscript.echo "OverwriteOutdated: " &
wmiSWbemObject.OverwriteOutdated
wmiSWbemObject.MaxFileSize = 51183616
wmiSWbemObject.OverwriteOutdated = -1
wmiSWbemObject.OverWritePolicy = "Never"
wmiSWbemObject.Put_(131072)
Next

0 new messages