Write-LogFileHere is a function to allow a script to log its execution. Output data into a log file. Options for path, extension …