All replies

If you want to log some information you simply have to write the information you want to the destination you want. For example a plain text log file with
Out-File or some structured data with
Export-CSV. Or you convert whatever you have to XML with
ConvertTo-XML or to HTML with
ConvertTo-HTML and write it with
Out-File. Or you create an event log entry with
New-WinEvent.

Read the help for all this cmdlets and you'll have a good idea how to create a log.

Regardless of all that: Please format your code as code here in the forum using the code posting tool prvovided. Thanks.