icinga-powershell-framework/lib/core/tools/New-IcingaTemporaryFile.psm1
2019-11-22 19:59:54 +01:00

16 lines
388 B
PowerShell

function New-IcingaTemporaryFile()
{
[string]$TmpFile = '';
[string]$FilePath = '';
while ($TRUE) {
$TmpFile = [string]::Format('tmp_icinga{0}.tmp', (Get-Random));
$FilePath = Join-Path $Env:TMP -ChildPath $TmpFile;
if ((Test-Path $FilePath) -eq $FALSE) {
break;
}
}
return (New-Item -Path $FilePath -ItemType File);
}