NTDOCAdministrator
(KiX Master)
2003-05-17 03:12 AM
Help Converting a VBS script to KIX

Does anyone know how to convert this .VBS script to KiX?

I can't seem to get the UseAmendedQualifiers portion of the script to work correctly in KiX.

http://msdn.microsoft.com/library /default.asp?url=/library/en-us/cpref/html/frlrfsystemmanagementputoptionsclassuseamendedqualifierstopic.asp


' SetEventLogValues.vbs

Const wbemFlagUseAmendedQualifiers = &h20000
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2")
Set colNTEventLogFiles = objWMIService.ExecQuery _
("SELECT * FROM Win32_NTEventLogFile")
For each objNTEventLogFile in colNTEventLogFiles
objNTEventLogFile.MaxFileSize = 16750000
objNTEventLogFile.OverwriteOutDated = 0
objNTEventLogFile.Put_ wbemFlagUseAmendedQualifiers
Next


[ 17. May 2003, 03:24: Message edited by: NTDOC ]


NTDOCAdministrator
(KiX Master)
2003-05-17 03:59 AM
Re: Help Converting a VBS script to KIX

Shawn and I worked on this code a long time ago and could not get it to work on 2000. It would only work on XP.

Well, Shawn got it to work with 2000/XP now.


$wbemFlagUseAmendedQualifiers = &020000
$strComputer = "."

$objWMIService = GetObject("winmgmts:" +
"{impersonationLevel=impersonate,(Security)}!\\" +
$strComputer + "\root\cimv2")
$colNTEventLogFiles = $objWMIService.ExecQuery
("SELECT * FROM Win32_NTEventLogFile")

For each $objNTEventLogFile in $colNTEventLogFiles
$objNTEventLogFile.MaxFileSize = 16750000
$objNTEventLogFile.OverwriteOutDated = 0
$= $objNTEventLogFile.Put_($wbemFlagUseAmendedQualifiers)
Next


Kdyer
(KiX Supporter)
2003-05-17 04:59 AM
Re: Help Converting a VBS script to KIX

I remember Lonk built a converter for VBS2Kix somewhere..

Kent


LonkeroAdministrator
(KiX Master Guru)
2003-05-17 03:22 PM
Re: Help Converting a VBS script to KIX

I'm not actually sure doc what was so hard in this one...
pretty straight forward...


NTDOCAdministrator
(KiX Master)
2003-05-18 05:31 AM
Re: Help Converting a VBS script to KIX

This particular string would not work on 2000 for some reason. Shawn and I both tried multiple variations of code to make it work. It would work on XP but not on 2000. I don't have the original code snipets from before so I'm not sure if we changed something around this time that we didn't do last time, or if 2000 has some IE update that it did not have in the past that now makes it work.

$objNTEventLogFile.Put_($wbemFlagUseAmendedQualifiers)