• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
ControlUp Community

ControlUp Community

Connect, Learn, and Grow

  • Blog
  • Podcast
  • Meetups
  • Archives
  • Categories
    • ControlUp One Platform
    • ControlUp for Apps
    • ControlUp for Compliance
    • ControlUp for Desktops
    • ControlUp Scripts & Triggers
    • ControlUp Synthetic Monitoring
    • ControlUp for VDI
  • Topics
  • Events
    • Logos & Wallpaper
    • ControlUp.com
  • Join

Help Needed with ‘Analyze Logon Duration’ Script: Auto-Action Issue and Incomplete Output

Posted on June 9, 2023

A user experienced an issue with the "Analyze logon duration" script run as a triggered task, only seeing an error attachment instead of the full output they needed. Ton suggested removing the -ErrorAction SilentlyContinue part to see if this helps, and @member suggested it may be a permission issue. The automated script creates the same output, with priority given to stderr streams over stdout. Users should check the audit log and ensure the logging of events is enabled.


Read the entire ‘Troubleshooting "Analyze logon duration" Script Run As Triggered Task’ thread below:

Hi All, Hope you’re having a nice Friday!

I was wondering if anyone can help me with this issue I found with the "Analyze logon duration" script that I’m running as a triggered task.

When I run it manually against a session I do get the information I need in Output. And it does give me an Error, but I’m not too bothered about that as I still get my desired output.

However when my trigger runs and it auto actions the script I get only the error as attachment and not the whole output with the information I needed.

Anything I can do here or need to tweak?

Thank you in advance!


any thoughts @member @member?


~Not sure, but could it be you are running the script more than 60 minutes after the user has logged on?~

Edit: Nope, looking into the code further I don’t think that is it. What you can try is changing this line:

[array]$securityEvents = @( Get-WinEvent -FilterHashtable $securityFilter -ErrorAction SilentlyContinue)

Remove the -ErrorAction SilentlyContinue part. Then if there is an error actually reading the log that should show up.


Hi Ton,

Many thanks for your reply!

I’ve adjusted the script, the output shows the correct output but I’m still seeing an error when running the script manually.

I’ll keep an eye on my automated script action to see if that works better now.


As far as I’m aware:

The automated script generates the same output. Which you should be able to see in the audit log.

However, the email output attachment will prioritize errors. More specifically, stderr streams are prioritized over stdout.


I’d suggest that if you are modifying the script, modify the scripts to prevent error throws and write-errorThe error suggests that there were indeed no security events found. If you do not get any when running the script manually either, it would suggest either a permissions issue or that logging of these events is disabled somehow.

@member yer the expert, somewhere in the back of my mind there is a little voice saying this may have to be enabled first?


Sounds like a permission error to me if it works on the same/machine user if run manually

Continue reading and comment on the thread ‘Help Needed with ‘Analyze Logon Duration’ Script: Auto-Action Issue and Incomplete Output’.  Not a member? Join Here!


Categories: All Archives, ControlUp Scripts & Triggers
Topics: Logs, Scripts, Security, Triggers

Ask Us Anything, Connect, Learn, and Grow with the ControlUp Community!

Login to the ControlUp Community to ask us anything, stay up-to-date on what’s new and coming soon and meet other like-minded techies like you.

Not already a member? Join Today!

Primary Sidebar

ControlUp Academy

Enroll in ControlUp Academy for expert-led technical training, equipping you with skills to effectively deploy, manage, and grow your ControlUp investment.

Learn here >

Rotating Images

Hidden Gem from our Community on Slack!

ControlUp Betas - What's Coming Next?
NEW ControlUp Features - Stay Up-to-Date!
ControlUp Scripts - Scripting, Zero to Hero
Latest KB Articles - Be the First to Learn
Did you Know - with Sivan Kroitoru
Practical Perspectives Technical Use Case Training

Video Tutorials Library

Visit our technical how-to videos, offering step-by-step tutorials on advanced features, troubleshooting, and best practices.

Watch here >

ControlUp Blog

Check out the ControlUp blog for expert advice and in-depth analysis.

Read here >

ControlUp Script Library

Visit the ControlUp technical script library, which offers a multitude of pre-built scripts and custom actions for your monitoring and troubleshooting requirements.

See here >

ControlUp Support

Visit the ControlUp support home and to delve deeper into ControlUp solutions.

Browse here >

Download ControlUp RealTime DX

Start with ControlUp for real-time end-user environment insights, swift troubleshooting, and unprecedented performance optimization. Download now.

Download here >

Footer

      

ControlUp Community
Of Techie, By Techie, For Techie!

Terms of Use | Privacy Policy | Security
Dive Deeper, Learn more at ControlUp.com

  • facebook
  • twitter
  • youtube
  • linkedin

© 2023–2025 ControlUp Technologies LTD, All Rights Reserved.

We use cookies to ensure that we give you the best experience on our website. by continuing to use this site you agree to our Cookie policy..