added function EnumUserProfiles

This commit is contained in:
2022-11-19 14:38:02 -05:00
parent 5a08df43f0
commit 64d6b36bd0
+11 -1
View File
@@ -605,7 +605,7 @@ function Get-LiquidFilesCLI {
# Function to determine if an app is running
function IsRunning ([Parameter(ValueFromPipeline=$true)][string]$Name) {
$RunningInstances = Get-Process | Where { $_.Name -ilike $Name }
$RunningInstances = Get-Process | Where-Object { $_.Name -ilike $Name }
If ( $RunningInstances ) { Return $true } Else { Return $false }
}
@@ -734,5 +734,15 @@ function WriteToFile_UTF8NoBOM {
Catch { LogErr $_.Exception.Message }
}
# Function to enumerate all user profile folders
function EnumUserProfiles {
$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
}
Setup-MSPDirectories
Setup-LogFile