PowerShell Script working fine outside of Opalis, bombing when run from within Opalis Script Object

Problem:opalis powershell recycle start iis application pool .net script object

I have a PowerShell script that works fine outside of Opalis. When you pass it the server name and IIS application pool name it will start the app pool. The problem is that once I put the script in Opalis I am getting the following error:

“Object reference not set to an instance of an object.”

Here is the relevant bit of code:

        if ($pool.Name -eq $BadPool)
                $Recycled = 1
                $TheResult = "$BadPool was started..."

The script is bombing out at the line that says $pool.Start() – if I remove that line the script runs perfectly and $recycled is set to 1 (from 0).

Any idea why that doesn’t work from within Opalis?? Any help is appreciated, going crazy here.


I got it to work, simply by using:

$go = $pool.Start()

instead of just


Anyone have an idea why both methods work via Powershell, but only the former from within Opalis?

I confirmed via “$pool | get-member” it does have the start/stop/recycle methods, so I think I’m dealing with it correctly…? Question is why does Opalis handle it differently than just plain old Powershell?

One suggestion I have for the Opalis team is to have some level of script debugging WITHIN the Opalis Run .Net Script Object. The way Opalis is handling my PowerShell scripts doesn’t seem to be consistent with what I’m seeing in PowerGUI, for example. Maybe my syntax is not following best practices, who knows. But I’ll only be able to troubleshoot if Opalis tells me why my scripts are bombing!

- Rezilient

This entry was posted in System Center Opalis. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>