creating temp files in PowerShell

To create a temporary file you can simply use:
$tempFile = [System.IO.Path]::GetTempFileName()
Just use like a regular file. The temp-file will be deleted after the execution of the script.
You don’t have to clean up the mess yourself.

Disclaimer
cheatsheet dos