remove duplicated functions from Tools.ps1
This commit is contained in:
@@ -1,21 +1,5 @@
|
||||
. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1')))
|
||||
|
||||
# Function to enumerate all user profile folders
|
||||
Function Get-UserProfiles {
|
||||
$ProfilePath = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name ProfilesDirectory).ProfilesDirectory
|
||||
$UserProfilePaths = @()
|
||||
ForEach ( $userProfile in (Get-ChildItem -Path $ProfilePath | Where-Object { $_.PSIsContainer }) ) {
|
||||
$UserProfilePaths += ,@($userProfile.FullName)
|
||||
}
|
||||
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
|
||||
$OlderThan = 7
|
||||
$TimeDelta = New-TimeSpan -Days $OlderThan
|
||||
|
||||
Reference in New Issue
Block a user