added Get-UserProfiles func from Tools.ps1
This commit is contained in:
@@ -1,5 +1,15 @@
|
|||||||
#. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1')))
|
#. $([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-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -Name ProfilesDirectory)
|
||||||
|
$UserProfilePaths = @()
|
||||||
|
ForEach ( $userProfile in (Get-ChildItem -Path $ProfilePath | Where-Object { $_.PSIsContainer }) ) {
|
||||||
|
$UserProfilePaths += ,@($userProfile.FullName)
|
||||||
|
}
|
||||||
|
Return $UserProfilePaths
|
||||||
|
}
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
Reference in New Issue
Block a user