Execute or call VBscript from outside MP in SCOM
hi..
i create one vb.script file and save this in the following path(c:\syatem\ss.vbs)
code;
Dim sObjectName, sCounterName, sInstanceName
Dim oAPI, oPerformancePropertyBag
Set oAPI = CreateObject("MOM.ScriptAPI")
sObjectName = WScript.Arguments(0)
sCounterName = WScript.Arguments(1)
sInstanceName = WScript.Arguments(2)
Call oAPI.LogScriptEvent("CollectSystemDetails.vbs", 101, 0, "Cpu_util.vbs rule execueted sucessfully... " & sObjectName & sCounterName & sInstanceName)
Set oPerformancePropertyBag = oAPI.CreateTypedPropertyBag(2)
oPerformancePropertyBag.AddValue "ObjectName", sObjectName
oPerformancePropertyBag.AddValue "CounterName", sCounterName
oPerformancePropertyBag.AddValue "InstanceName", sInstanceName
oPerformancePropertyBag.AddValue "Value", 89
oAPI.AddItem oPerformancePropertyBag
Call oAPI.ReturnItems
when i call this file from MP rule
like
<ScriptBody>
Set objShell = CreateObject("WScript.Shell")
objShell.run("cscript c:\syatem\ss.vbs SystemDetails Cpu_util Summary")
</ScriptBody>
it access that file scucessfully and event also created.
but the propertybag is not created. it display warinng msg in logevent like
"The process started at 7:16:02 PM failed to create System.PropertyBagData, no errors detected in the output. The process exited with 0"
so how to create propertybag in vbscript running outside MP.
help me :)
regards
satheesh
June 27th, 2011 2:31pm
You didn't return anything.
Also, what are you trying for here:
oAPI.CreateTypedPropertyBag(2)
And calling returnItems is meant to return multiple items. You should be calling ReturnItem and pass your property bag as the argumentMicrosoft Corporation
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2011 6:48pm
hi,, Rogers,
oAPI.CreateTypedPropertyBag(2)---> create propertybag for performance data. thts y i give 2 to mention it.
i tried like this also but it not worked.
Call oAPI.Return(oPerformancePropertyBag)
it create warning event and tell like this "The process started at 12:16:02 AM failed to create System.PropertyBagData, no errors detected in the output. The process exited with 0"
next, what should i do?
its possible to create propertybag through running VBscript from outside MP?
help me :)
regards
satheesh
June 28th, 2011 7:58am
Hi,
Regarding the CreateTypedPropertyBag method, please also refer to:
MOMScriptAPI.CreateTypedPropertyBag Method
http://blogs.msdn.com/b/mariussutara/archive/2008/01/24/momscriptapi-createtypedpropertybag-method.aspx
Trending growth where there is no registered data source
http://blogs.technet.com/b/jonathanalmquist/archive/2010/12/02/trending-growth-where-there-is-no-registered-data-source.aspx
In addition, please also check the security software:
Anti-virus software may cause script failures in OpsMgr 2007
http://blogs.technet.com/b/operationsmgr/archive/2009/01/22/anti-virus-software-may-cause-script-failures-in-opsmgr-2007.aspx
Hope this helps.
Thanks.
Nicholas Li - MSFT
Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2011 8:06am