Error running powershell script - VisualCron - Forum

Community forum

Danny van Oijen
2017-07-03T11:22:15Z
I created a script that collects information from a Exchange Server.
When it comes to the point it needs to collect mailbox statistics it generates an error in VisualCron.

ExecuteProcess("E:\Program Files (x86)\VisualCron\\PowerShell\TaskPowerShell.exe" 450195)->System.Management.Automation.CmdletInvocationException: You cannot call a method on a null-valued expression. ---> System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.<>c__DisplayClassa.<InvokeWithPipe>b__8()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, O

The script is needs to run:
  MailboxStatisticsReport Template.txt (6kb) downloaded 39 time(s).

The -SilentlyContinue does not work in VisualCron either,.
Outside VisualCron it works.
Support
2017-07-04T09:51:31Z
It seems that one value that you pass to the script or some value you pickup from other place is null. You probably need to debug it more to understand why. Maybe by hard coding one value at a time.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Danny van Oijen
2017-07-05T10:09:41Z
Henrik,

You are right, when a mailbox has not been accessed than it normally wil send a warning stating teh mailbox has not been accessed.
That is why i have put the -SilentlyContinue, but VC does not like that...
Support
2017-07-05T14:10:23Z
If it does not work a workaround could be to use the Execute Task. Full path to powershell.exe in command and full path to script in argument.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top