When executing an Opalis Integration Server Policy that utilizes the Run .Net Script object, the following error may be returned in the Error Summary Text Published Data of the Run .Net Script object and the object status returns as failed:
"Object reference not set to an instance of an object."
This can occur if a statement within the code supplied in the Details tab of the Run .Net Script Opalis object is attempting to perform an action against an object that has not yet been instantiated.
To resolve this issue, check the code supplied to ensure that no variables are being declared that match the names of any variables declared in the Published Data tab of the Run .Net Script object. For each Published Data item added to the Run .Net Script object, a "Variable name" property is provided which at runtime is converted into a declared variable.
If a declaration exists in the code that also exists in a Published Data definition, remove the variable declaration from the code.
Published Data Item:
Name: My Example Output
Variable name: myOutput
Dim myInput As String = "Testing"
Dim myOutput As String = myInput
The above code will return the error because myOutput variable is being declared twice - once in the code and once in the runtime class definition that will be wrapped around the code to produce the runtime assembly.
Inspect the code to see if there are any variables being set before they are instantiated. The best way to do this would be to bring the code into Visual Studio and setup all the appropriate references and test out the code execution there.
If an object is referenced before it is declared, correct the code.
For the latest version of this article see the link below:
J.C. Hornbeck | System Center Knowledge Engineer
The App-V Team blog: http://blogs.technet.com/appv/
The WSUS Support Team blog: http://blogs.technet.com/sus/
The SCMDM Support Team blog: http://blogs.technet.com/mdm/
The ConfigMgr Support Team blog: http://blogs.technet.com/configurationmgr/
The SCOM 2007 Support Team blog: http://blogs.technet.com/operationsmgr/
The SCVMM Team blog: http://blogs.technet.com/scvmm/
The MED-V Team blog: http://blogs.technet.com/medv/
The DPM Team blog: http://blogs.technet.com/dpm/
The OOB Support Team blog: http://blogs.technet.com/oob/
The Opalis Team blog: http://blogs.technet.com/opalis
The Service Manager Team blog: http: http://blogs.technet.com/b/servicemanager
The AVIcode Team blog: http: http://blogs.technet.com/b/avicode