As our team makes more and more complex scripts and trigger actions, we were called on to write data to a txt log file. This is the base code needed to use powershell to create and write to a simple log file.
See Also
PowerShell Event Logger
Zipping Files With Powershell
Find String in any File in Folder with PowerShell
Check Multiple Nodes for a Running Service, Then Show up or Down based on the number of Servers Running the Service