1 Reply Latest reply: Feb 21, 2012 6:53 PM by aLTeReGo RSS

Using 3rd Party Cmdlets in Powershell script monitor

kipyoung20
Currently Being Moderated

I need to use a third party cmdlet in a powershell monitor... The cmdlet in question is NetCmdlets from powershellinside dot com.

When running locally on the Orion server through the PowerShell ISE, I get the expected output, when running in APM I get this:

The term 'get-imap' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Script arguments:

-server "servername" -user "username" -password "somethingelse"

Script body:

param( [string] $server = "",
       [string] $user,
       [string] $password,
       [switch] $pop)

if(!(Get-Module | Where {$_.Name -eq "NetCmdlets"})) {
    Import-Module "NetCmdlets"
}

if ($server -eq "") {
 $server = read-host "Mail Server [localhost]"
 if ($server -eq "") { $server = "localhost" }
}

if ($pop) {
 get-pop -server $server -user $user -password $password | sort Date -descending
}
else {
 get-imap -server $server -user $user -password $password | WHERE-Object {$_.Subject -eq "Subject of an email message"}
}
   
trap{
 write-host "Exception occurred (please find more information below), script execution was terminated."
 break
}

More Like This

  • Retrieving data ...