added Remove-File function

This commit is contained in:
2021-10-08 05:42:05 -04:00
parent 98571828d8
commit 8714ddb213
+13
View File
@@ -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