added IsRunning func from Tools.ps1

This commit is contained in:
2025-01-06 12:39:06 -05:00
parent 8ace7c6be1
commit 4a5043ca74
+6
View File
@@ -10,6 +10,12 @@ Function Get-UserProfiles {
Return $UserProfilePaths Return $UserProfilePaths
} }
# Function to determine if an app is running
Function IsRunning ([Parameter(ValueFromPipeline=$true)][string]$Name) {
$RunningInstances = Get-Process | Where-Object { $_.Name -ilike $Name }
If ( $RunningInstances ) { Return $true } Else { Return $false }
}
# When deleting temp files en masse, only delete files/folders older than the number of days specified here # When deleting temp files en masse, only delete files/folders older than the number of days specified here
$OlderThan = 7 $OlderThan = 7
$TimeDelta = New-TimeSpan -Days $OlderThan $TimeDelta = New-TimeSpan -Days $OlderThan