Powershell Task: issue on Output message - VisualCron - Forum

Community forum

alessandro.spino
2015-03-17T11:49:03Z
Hello,
sorry but I need a suggestion: I'm using this simple script into a PowerShell Task where I should extract a date from a specific position only if it exist and do nothin in case the string does not exist, but when it find it the Output of the task is correct while in case of missing the string it return a message instead of nothing. Do you have any suggestion?
thanks a lot
--Script--
$Partenza=Select-String \\itcogls1\d$\LOG\LOG_XXXXXX_12-03-2015.log -pattern XXXXXXX_XXXX_LINDT |Out-String -Width 120
if($Partenza=$)
{
$Partenza.Substring(72,19)
}
else
{
"command failed"
}
------------ Output on Error----------------------
13:16:51: Server->Execute path: C:\Program Files\VisualCron\\TaskPowerShell.exe
13:16:51: Server->Executing Task process
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->CreateService->Response channel created on address: /TaskProcess/32136
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Requesting Task information
13:16:51: Server->Sending Task information
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Task information sent
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Task information received
13:16:52: Server->Task information sent
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before PowerShell execution
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: VisualCronAPI, Version=1.0.3.19714, Culture=neutral, PublicKeyToken=55f7a52402de1c04
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before impersonation
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.CreateRunspace
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Commands.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.WSMan.Management, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.WSMan.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Commands.Utility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.ConsoleHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Commands.Management, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.ThreadOptions
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.Open
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:53: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Success opening Runspace(1): UseCurrentThread
13:16:53: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.CreatePipeline
13:16:53: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.Invoke
13:16:54: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Preparing Task log
13:16:54: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Sending result
13:16:54: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Result sent
Is 64 bit process: False
Is 64 bit operating system: False
Current user: NT AUTHORITY\SYSTEM
.NET version: 4.0.30319.1008
AddExceptionHandlers
AddAssemblyLoadEvent
Argument(0): 32136
CreateTaskServiceChannel
CreateTaskServiceChannel->Complete
pts.CreateService(UniqueAddressId)
pts.CreateService(UniqueAddressId)->Complete
13:16:54: Server->Executing Task process exited with exit code: 0
13:16:54: Server->Waiting for completion and result
13:16:54: Server->Task result received, success: False
13:16:51: Server->Execute path: C:\Program Files\VisualCron\\TaskPowerShell.exe
13:16:51: Server->Executing Task process
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->CreateService->Response channel created on address: /TaskProcess/32136
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Requesting Task information
13:16:51: Server->Sending Task information
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Task information sent
13:16:51: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Task information received
13:16:52: Server->Task information sent
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before PowerShell execution
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: VisualCronAPI, Version=1.0.3.19714, Culture=neutral, PublicKeyToken=55f7a52402de1c04
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before impersonation
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.CreateRunspace
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Commands.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.WSMan.Management, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.WSMan.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Commands.Utility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.ConsoleHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Commands.Management, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: Microsoft.PowerShell.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.ThreadOptions
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.Open
13:16:52: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Assembly loaded: System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
13:16:53: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Success opening Runspace(1): UseCurrentThread
13:16:53: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.CreatePipeline
13:16:53: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Before runspace.Invoke
13:16:54: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Preparing Task log
13:16:54: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Sending result
13:16:54: ExecuteProcess("C:\Program Files\VisualCron\\TaskPowerShell.exe" 32136)->Result sent
Is 64 bit process: False
Is 64 bit operating system: False
Current user: NT AUTHORITY\SYSTEM
.NET version: 4.0.30319.1008
AddExceptionHandlers
AddAssemblyLoadEvent
Argument(0): 32136
CreateTaskServiceChannel
CreateTaskServiceChannel->Complete
pts.CreateService(UniqueAddressId)
pts.CreateService(UniqueAddressId)->Complete
13:16:54: Server->Executing Task process exited with exit code: 0
13:16:54: Server->Waiting for completion and result
13:16:54: Server->Task result received, success: False
Support
2015-03-18T08:52:35Z
The reason why you get that full output is because something in the script fails. I think you need some error handling in your script.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top