Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

WMI script

Updated: 29 Jul 2010 | 3 comments
rantpe's picture
0 0 Votes
Login to vote

Hi
I trying to create WMI script (with VMI Code creator):
---------------------- BOF -----------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\DEFAULT")
' Obtain an instance of the the class
' using a key property value.
Set objShare = objWMIService.Get("VirtualSoftwarePackage")

' Obtain an InParameters object specific
' to the method.
Set objInParam = objShare.Methods_("Import"). _
    inParameters.SpawnInstance_()

' Add the input parameters.
objInParam.Properties_.Item("Filename") =  "C:\SWVAPPS\XnView2.vsa"
objInParam.Properties_.Item("Overwrite") =  True

' Execute the method and obtain the return status.
' The OutParameters object in objOutParams
' is created by the provider.
Set objOutParams = objWMIService.ExecMethod("VirtualSoftwarePackage", "Import", objInParam)

' List OutParams
Wscript.Echo "Out Parameters: "
Wscript.echo "PackageId: " & objOutParams.PackageId
Wscript.echo "ReturnValue: " & objOutParams.ReturnValue
------------------------ EOF ----------------------

Result
Out Paramets : " " (none)
PackageId:
ReturnValue: 1040

What i am doing wrong here (i newbie with WMIscript)

-Petri

Comments

EdT's picture
13
Oct
2009
0 Votes 0
Login to vote

What are you seeing?

First of all, standard WMI does not know about Virtual Packages, so do you have whatever is necessary to be installed to provide this add-on functionality?
Secondly, what are you trying to do? We need to know this rather than try and guess from your code - if the code is wrong we can end up chasing the wrong tail.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

AngelD's picture
13
Oct
2009
0 Votes 0
Login to vote
rantpe's picture
13
Oct
2009
0 Votes 0
Login to vote

What i try to do

I am not very good at writing vbs scripts.
But now i have to vbs script for SCCM/SMS to import and activate (auto) apps.
I was trying to use WMI code creator to create base script to import application.

-Petri