Thursday, 23 June 2016

Powershell infinity loop

When you work with application Support or devlopment, There some times there is a need  to capture the logs occurance of certain activity , however you do not know when it will occurr and you want alert mails and customized report to generate when it occur.

You can Scheduled your script to run in task schedular every minute or second, What you will do when you do not have the right to update the task schedular or view it?

Scripter more commonly use the for(;;) construct to signify an infinite loop in Powershell.

In Below Screenshot, the script sleep for every 3 min and invoke the logic of the script.

Thank You.

No comments:

Post a Comment


Born as Mathematician, Found love in Scripting and want to have an affair with C#

Total Pageviews