Be Aware of Side Effects

by Jun 12, 2014

There are plenty of low level system functions that PowerShell can use. This one, for example, creates a temporary file name:

[System.IO.Path]::GetTempFileName() 

However, it does not only do that. It also actually creates the file. So if you use this function to create temporary file names, you might end up with a lot of orphaned files in your file system. Use it only if you actually want a temporary file to be created.

Twitter This Tip! ReTweet this Tip!