From 8714ddb213bc587c33dcd23b33297a2f88b7189d Mon Sep 17 00:00:00 2001 From: David Yoder Date: Fri, 8 Oct 2021 05:42:05 -0400 Subject: [PATCH] added Remove-File function --- Tools.ps1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tools.ps1 b/Tools.ps1 index c7098c0..401c446 100644 --- a/Tools.ps1 +++ b/Tools.ps1 @@ -512,5 +512,18 @@ function Install-MSP360Module { Catch { LogErr $_.Exception.Message } } + # Function to delete a file +function Remove-File ([Parameter(ValueFromPipeline=$true)][string]$path) { + If ( Test-Path $path ) { + If ( !((Get-Item $path) -is [System.IO.DirectoryInfo]) ) { + Try { + LogMsg "Delete ""${path}""" + Remove-Item $path -Force + } + Catch { LogErr $_.Exception.Message } + } + } +} + Setup-MSPDirectories Setup-LogFile \ No newline at end of file