How to create a control/checking script in powershell?

82 views Asked by At

I am new to powershell scripting. I've created a script in powershell, and I would like to create a script to verify that it has been executed properly

For example to verify that the purge has been executed.

Could you help me?

Thank you for your help!

1

There are 1 answers

0
Grinza On

I feel like this is somewhat broad as there are hundreds of ways to do this, but what I would probably go with is writing an entry somewhere at the end of the first script (Event Log, text file, SQL database) and letting the second script just test for the presence of the output, assuming having a script check another script is a hard requirement.

Look into Get-Help Write-EventLog Get-Help Get-EventLog Get-Help Out-File Get-Help Get-Content

SQL might be a little too much for a new sheller, but if you're interested, google around for System.Data.SqlClient

If a second script isn't required, you may be better suited using a try/catch block within your first script, using the catch to notify you (via something like Send-MailMessage) or log the failure someone for later perusal.