Releases: LarryWisherMan/WinProfileOps
v0.3.0-preview0007
[v0.3.0-preview0007]
Fixed
- Removed bug from
Process-RegistryProfiles
regarding populating theFolderName
variable. - Refactored model to create a UserProfile object to better handel different removal
scenarios. - Fixed bug in
Join-UserProfiles
regarding User Folders with no resolvable SIDS
Added
Functions
-
New helper function
Validate-SIDFormat
to verify SID value upon retrieval in
Get-ProfilePathFromSID
. -
Admin Detection and Environment Variable: Added logic to detect whether
the current user is an administrator and set an environment variable
WinProfileOps_IsAdmin
accordingly.-
If the user is an administrator,
$env:WinProfileOps_IsAdmin
is set to
$true
. If not, it's set to$false
. -
The environment variable is automatically removed when the module is unloaded
or when PowerShell exits. -
Registered an
OnRemove
script block and aPowerShell.Exiting
event to
ensure cleanup of the environment variable on module removal or session exit.
-
-
Remove-UserProfilesFromRegistry: Added a new function to remove user profiles
from the Windows registry based on SIDs, Usernames, or UserProfile objects.-
Supports three parameter sets:
UserProfileSet
,SIDSet
, andUserNameSet
. -
Can be run in
AuditOnly
mode, where no actual deletion is performed, or
in deletion mode where profiles are removed. -
Includes a
Force
switch to bypass confirmation prompts and a
ComputerName
parameter for targeting remote computers. -
Graceful error handling and logging for cases where the registry key cannot
be opened or profiles cannot be processed for specific computers.
-
Environment Variables
-
$env:WinProfileOps_IsAdmin
: A boolean value that determines if the current
user has administrative privileges. This is set by checking the user's security
role against the built-in Administrator group using Windows security principals. -
$env:WinProfileOps_RegistryPath
: Specifies the registry path used to
manage user profiles. Default value:"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
. -
$env:WinProfileOps_RegistryHive
: Defines the registry hive to use, which
is set toLocalMachine
by default. -
$env:WinProfileOps_RegBackUpDirectory
: Specifies the directory where
registry backups are stored. Default value:"C:\LHStuff\RegBackUp"
. -
$env:WinProfileOps_ProfileFolderPath
: The profile folder path, defaulting
to the system drive'sUsers
folder. Example:"C:\Users"
.
Changed
-
Get-UserProfilesFromRegistry: Updated the function to handle scenarios
where the current user does not have administrative privileges.-
The function now checks if the user is an administrator by evaluating the
WinProfileOps_IsAdmin
environment variable. -
If the user has administrator privileges, the function retrieves user
profiles from the registry usingGet-SIDProfileInfo
. -
A warning is logged when the fallback method is used, indicating that special
system accounts are excluded.
-
-
Updated
UserProfile
object creation inTest-OrphanedProfile
for
$AccessError
scenarios. -
The module is now using
WinRegOps
version0.4.0
for more refined registry
value retrieval. -
Refactored
Get-SIDFromUsername
to use.NET
classes
(System.Security.Principal.NTAccount
andSystem.Security.Principal.SecurityIdentifier
)
instead of relying onGet-CimInstance
for SID resolution. -
Get-UserAccountFromSID
andGet-SIDFromUsername
now invoke locally / Remotely
to resolve without null values
v0.3.0-preview0006
[v0.3.0-preview0006]
Fixed
- Removed bug from
Process-RegistryProfiles
regarding populating theFolderName
variable. - Refactored model to create a UserProfile object to better handel different removal
scenarios. - Fixed bug in
Join-UserProfiles
regarding User Folders with no resolvable SIDS
Added
Functions
-
New helper function
Validate-SIDFormat
to verify SID value upon retrieval in
Get-ProfilePathFromSID
. -
Admin Detection and Environment Variable: Added logic to detect whether
the current user is an administrator and set an environment variable
WinProfileOps_IsAdmin
accordingly.-
If the user is an administrator,
$env:WinProfileOps_IsAdmin
is set to
$true
. If not, it's set to$false
. -
The environment variable is automatically removed when the module is unloaded
or when PowerShell exits. -
Registered an
OnRemove
script block and aPowerShell.Exiting
event to
ensure cleanup of the environment variable on module removal or session exit.
-
-
Remove-UserProfilesFromRegistry: Added a new function to remove user profiles
from the Windows registry based on SIDs, Usernames, or UserProfile objects.-
Supports three parameter sets:
UserProfileSet
,SIDSet
, andUserNameSet
. -
Can be run in
AuditOnly
mode, where no actual deletion is performed, or
in deletion mode where profiles are removed. -
Includes a
Force
switch to bypass confirmation prompts and a
ComputerName
parameter for targeting remote computers. -
Graceful error handling and logging for cases where the registry key cannot
be opened or profiles cannot be processed for specific computers.
-
Environment Variables
-
$env:WinProfileOps_IsAdmin
: A boolean value that determines if the current
user has administrative privileges. This is set by checking the user's security
role against the built-in Administrator group using Windows security principals. -
$env:WinProfileOps_RegistryPath
: Specifies the registry path used to
manage user profiles. Default value:"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
. -
$env:WinProfileOps_RegistryHive
: Defines the registry hive to use, which
is set toLocalMachine
by default. -
$env:WinProfileOps_RegBackUpDirectory
: Specifies the directory where
registry backups are stored. Default value:"C:\LHStuff\RegBackUp"
. -
$env:WinProfileOps_ProfileFolderPath
: The profile folder path, defaulting
to the system drive'sUsers
folder. Example:"C:\Users"
.
Changed
-
Get-UserProfilesFromRegistry: Updated the function to handle scenarios
where the current user does not have administrative privileges.-
The function now checks if the user is an administrator by evaluating the
WinProfileOps_IsAdmin
environment variable. -
If the user has administrator privileges, the function retrieves user
profiles from the registry usingGet-SIDProfileInfo
. -
If the user lacks administrative privileges, the function falls back to the
Get-SIDProfileInfoFallback
method, which retrieves user profiles using
CIM/WMI without requiring registry access. -
A warning is logged when the fallback method is used, indicating that special
system accounts are excluded.
-
-
Refactored
Process-RegistryProfiles
to better account for access denied errors
when testing profile paths withTest-FolderExists
. -
Updated
UserProfile
object creation inTest-OrphanedProfile
for
$AccessError
scenarios. -
The module is now using
WinRegOps
version0.4.0
for more refined registry
value retrieval. -
Refactored
Get-SIDFromUsername
to use.NET
classes
(System.Security.Principal.NTAccount
andSystem.Security.Principal.SecurityIdentifier
)
instead of relying onGet-CimInstance
for SID resolution.
v0.3.0-preview0005
[v0.3.0-preview0005]
Fixed
- Removed bug from
Process-RegistryProfiles
regarding populating theFolderName
variable. - Refactored model to create a UserProfile object to better handel different removal
scenarios.
Added
Functions
-
New helper function
Validate-SIDFormat
to verify SID value upon retrieval in
Get-ProfilePathFromSID
. -
Admin Detection and Environment Variable: Added logic to detect whether
the current user is an administrator and set an environment variable
WinProfileOps_IsAdmin
accordingly.-
If the user is an administrator,
$env:WinProfileOps_IsAdmin
is set to
$true
. If not, it's set to$false
. -
The environment variable is automatically removed when the module is unloaded
or when PowerShell exits. -
Registered an
OnRemove
script block and aPowerShell.Exiting
event to
ensure cleanup of the environment variable on module removal or session exit.
-
-
Remove-UserProfilesFromRegistry: Added a new function to remove user profiles
from the Windows registry based on SIDs, Usernames, or UserProfile objects.-
Supports three parameter sets:
UserProfileSet
,SIDSet
, andUserNameSet
. -
Can be run in
AuditOnly
mode, where no actual deletion is performed, or
in deletion mode where profiles are removed. -
Includes a
Force
switch to bypass confirmation prompts and a
ComputerName
parameter for targeting remote computers. -
Graceful error handling and logging for cases where the registry key cannot
be opened or profiles cannot be processed for specific computers.
-
Environment Variables
-
$env:WinProfileOps_IsAdmin
: A boolean value that determines if the current
user has administrative privileges. This is set by checking the user's security
role against the built-in Administrator group using Windows security principals. -
$env:WinProfileOps_RegistryPath
: Specifies the registry path used to
manage user profiles. Default value:"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
. -
$env:WinProfileOps_RegistryHive
: Defines the registry hive to use, which
is set toLocalMachine
by default. -
$env:WinProfileOps_RegBackUpDirectory
: Specifies the directory where
registry backups are stored. Default value:"C:\LHStuff\RegBackUp"
. -
$env:WinProfileOps_ProfileFolderPath
: The profile folder path, defaulting
to the system drive'sUsers
folder. Example:"C:\Users"
.
Changed
-
Get-UserProfilesFromRegistry: Updated the function to handle scenarios
where the current user does not have administrative privileges.-
The function now checks if the user is an administrator by evaluating the
WinProfileOps_IsAdmin
environment variable. -
If the user has administrator privileges, the function retrieves user
profiles from the registry usingGet-SIDProfileInfo
. -
If the user lacks administrative privileges, the function falls back to the
Get-SIDProfileInfoFallback
method, which retrieves user profiles using
CIM/WMI without requiring registry access. -
A warning is logged when the fallback method is used, indicating that special
system accounts are excluded.
-
-
Refactored
Process-RegistryProfiles
to better account for access denied errors
when testing profile paths withTest-FolderExists
. -
Updated
UserProfile
object creation inTest-OrphanedProfile
for
$AccessError
scenarios. -
The module is now using
WinRegOps
version0.4.0
for more refined registry
value retrieval. -
Refactored
Get-SIDFromUsername
to use.NET
classes
(System.Security.Principal.NTAccount
andSystem.Security.Principal.SecurityIdentifier
)
instead of relying onGet-CimInstance
for SID resolution.
v0.3.0-preview0004
[v0.3.0-preview0004]
Fixed
- Removed bug from
Process-RegistryProfiles
regarding populating theFolderName
variable.
Added
Functions
-
New helper function
Validate-SIDFormat
to verify SID value upon retrieval in
Get-ProfilePathFromSID
. -
Admin Detection and Environment Variable: Added logic to detect whether
the current user is an administrator and set an environment variable
WinProfileOps_IsAdmin
accordingly.-
If the user is an administrator,
$env:WinProfileOps_IsAdmin
is set to
$true
. If not, it's set to$false
. -
The environment variable is automatically removed when the module is unloaded
or when PowerShell exits. -
Registered an
OnRemove
script block and aPowerShell.Exiting
event to
ensure cleanup of the environment variable on module removal or session exit.
-
-
Remove-UserProfilesFromRegistry: Added a new function to remove user profiles
from the Windows registry based on SIDs, Usernames, or UserProfile objects.-
Supports three parameter sets:
UserProfileSet
,SIDSet
, andUserNameSet
. -
Can be run in
AuditOnly
mode, where no actual deletion is performed, or
in deletion mode where profiles are removed. -
Includes a
Force
switch to bypass confirmation prompts and a
ComputerName
parameter for targeting remote computers. -
Graceful error handling and logging for cases where the registry key cannot
be opened or profiles cannot be processed for specific computers.
-
Environment Variables
-
$env:WinProfileOps_IsAdmin
: A boolean value that determines if the current
user has administrative privileges. This is set by checking the user's security
role against the built-in Administrator group using Windows security principals. -
$env:WinProfileOps_RegistryPath
: Specifies the registry path used to
manage user profiles. Default value:"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
. -
$env:WinProfileOps_RegistryHive
: Defines the registry hive to use, which
is set toLocalMachine
by default. -
$env:WinProfileOps_RegBackUpDirectory
: Specifies the directory where
registry backups are stored. Default value:"C:\LHStuff\RegBackUp"
. -
$env:WinProfileOps_ProfileFolderPath
: The profile folder path, defaulting
to the system drive'sUsers
folder. Example:"C:\Users"
.
Changed
-
Get-UserProfilesFromRegistry: Updated the function to handle scenarios
where the current user does not have administrative privileges.-
The function now checks if the user is an administrator by evaluating the
WinProfileOps_IsAdmin
environment variable. -
If the user has administrator privileges, the function retrieves user
profiles from the registry usingGet-SIDProfileInfo
. -
If the user lacks administrative privileges, the function falls back to the
Get-SIDProfileInfoFallback
method, which retrieves user profiles using
CIM/WMI without requiring registry access. -
A warning is logged when the fallback method is used, indicating that special
system accounts are excluded.
-
-
Refactored
Process-RegistryProfiles
to better account for access denied errors
when testing profile paths withTest-FolderExists
. -
Updated
UserProfile
object creation inTest-OrphanedProfile
for
$AccessError
scenarios. -
The module is now using
WinRegOps
version0.4.0
for more refined registry
value retrieval. -
Refactored
Get-SIDFromUsername
to use.NET
classes
(System.Security.Principal.NTAccount
andSystem.Security.Principal.SecurityIdentifier
)
instead of relying onGet-CimInstance
for SID resolution.
v0.3.0-preview0003
[v0.3.0-preview0003]
Fixed
- Removed bug from
Process-RegistryProfiles
regarding populating theFolderName
variable.
Added
Functions
-
New helper function
Validate-SIDFormat
to verify SID value upon retrieval in
Get-ProfilePathFromSID
. -
Admin Detection and Environment Variable: Added logic to detect whether
the current user is an administrator and set an environment variable
WinProfileOps_IsAdmin
accordingly.-
If the user is an administrator,
$env:WinProfileOps_IsAdmin
is set to
$true
. If not, it's set to$false
. -
The environment variable is automatically removed when the module is unloaded
or when PowerShell exits. -
Registered an
OnRemove
script block and aPowerShell.Exiting
event to
ensure cleanup of the environment variable on module removal or session exit.
-
-
Remove-UserProfilesFromRegistry: Added a new function to remove user profiles
from the Windows registry based on SIDs, Usernames, or UserProfile objects.-
Supports three parameter sets:
UserProfileSet
,SIDSet
, andUserNameSet
. -
Can be run in
AuditOnly
mode, where no actual deletion is performed, or
in deletion mode where profiles are removed. -
Includes a
Force
switch to bypass confirmation prompts and a
ComputerName
parameter for targeting remote computers. -
Graceful error handling and logging for cases where the registry key cannot
be opened or profiles cannot be processed for specific computers.
-
Environment Variables
-
$env:WinProfileOps_IsAdmin
: A boolean value that determines if the current
user has administrative privileges. This is set by checking the user's security
role against the built-in Administrator group using Windows security principals. -
$env:WinProfileOps_RegistryPath
: Specifies the registry path used to
manage user profiles. Default value:"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
. -
$env:WinProfileOps_RegistryHive
: Defines the registry hive to use, which
is set toLocalMachine
by default. -
$env:WinProfileOps_RegBackUpDirectory
: Specifies the directory where
registry backups are stored. Default value:"C:\LHStuff\RegBackUp"
. -
$env:WinProfileOps_ProfileFolderPath
: The profile folder path, defaulting
to the system drive'sUsers
folder. Example:"C:\Users"
.
Changed
-
Get-UserProfilesFromRegistry: Updated the function to handle scenarios
where the current user does not have administrative privileges.-
The function now checks if the user is an administrator by evaluating the
WinProfileOps_IsAdmin
environment variable. -
If the user has administrator privileges, the function retrieves user
profiles from the registry usingGet-SIDProfileInfo
. -
If the user lacks administrative privileges, the function falls back to the
Get-SIDProfileInfoFallback
method, which retrieves user profiles using
CIM/WMI without requiring registry access. -
A warning is logged when the fallback method is used, indicating that special
system accounts are excluded.
-
-
Refactored
Process-RegistryProfiles
to better account for access denied errors
when testing profile paths withTest-FolderExists
. -
Updated
UserProfile
object creation inTest-OrphanedProfile
for
$AccessError
scenarios. -
The module is now using
WinRegOps
version0.4.0
for more refined registry
value retrieval.
v0.3.0-preview0002
[v0.3.0-preview0002]
Added
-
New helper function
Validate-SIDFormat
to verify SID value upon retrieval
inGet-ProfilePathFromSID
-
Admin Detection and Environment Variable: Added logic to detect whether the
current user is an administrator and set an environment variable
WinProfileOps_IsAdmin
accordingly.-
If the user is an administrator,
$ENV:WinProfileOps_IsAdmin
is set to
$true
. If not, it's set to$false
. -
The environment variable is automatically removed when the module is
unloaded or when PowerShell exits. -
Registered an
OnRemove
script block and aPowerShell.Exiting
event to
ensure cleanup of the environment variable on module removal or session exit.
-
-
Get-SIDProfileInfoFallback: Introduced a new fallback function
Get-SIDProfileInfoFallback
that retrieves non-special user profile
information using the CIM/WMI method.
Changed
-
Get-UserProfilesFromRegistry: Updated the function to handle scenarios
where the current user does not have administrative privileges.-
The function now checks if the user is an administrator by evaluating the
WinProfileOps_IsAdmin
environment variable. -
If the user has administrator privileges, the function retrieves user
profiles from the registry usingGet-SIDProfileInfo
. -
If the user lacks administrative privileges, the function falls back to the
Get-SIDProfileInfoFallback
method, which retrieves user profiles using
CIM/WMI without requiring registry access. -
A warning is logged when the fallback method is used, indicating that
special system accounts are excluded.
-
-
Refactored
Process-RegistryProfiles
to better account for access denied errors
when testing profile paths withTest-FolderExists
-
Updated
UserProfile
object creation inTest-OrphanedProfile
for
$AccessError
Scenarios -
Module is now using
WinRegOps
Version0.4.0
for more refined registry value
retrieval
v0.3.0-preview0001
[v0.3.0-preview0001]
Added
-
New helper function
Validate-SIDFormat
to verify SID value upon retrieval
inGet-ProfilePathFromSID
-
Admin Detection and Environment Variable: Added logic to detect whether the
current user is an administrator and set an environment variable
WinProfileOps_IsAdmin
accordingly.-
If the user is an administrator,
$ENV:WinProfileOps_IsAdmin
is set to
$true
. If not, it's set to$false
. -
The environment variable is automatically removed when the module is
unloaded or when PowerShell exits. -
Registered an
OnRemove
script block and aPowerShell.Exiting
event to
ensure cleanup of the environment variable on module removal or session exit.
-
-
Get-SIDProfileInfoFallback: Introduced a new fallback function
Get-SIDProfileInfoFallback
that retrieves non-special user profile
information using the CIM/WMI method.
Changed
-
Get-UserProfilesFromRegistry: Updated the function to handle scenarios
where the current user does not have administrative privileges.-
The function now checks if the user is an administrator by evaluating the
WinProfileOps_IsAdmin
environment variable. -
If the user has administrator privileges, the function retrieves user
profiles from the registry usingGet-SIDProfileInfo
. -
If the user lacks administrative privileges, the function falls back to the
Get-SIDProfileInfoFallback
method, which retrieves user profiles using
CIM/WMI without requiring registry access. -
A warning is logged when the fallback method is used, indicating that
special system accounts are excluded.
-
v0.2.0
[v0.2.0]
Added
-
Added core functions
-
configured
WinRegOps
as a dependant module -
Updated build file for release
-
Comment-based help documentation added for the following public functions:
Get-AllUserProfiles
Get-OrphanedProfiles
Remove-OrphanedProfiles
Remove-SIDProfile
Get-UserProfileFolders
Get-RegistryUserProfiles
Get-UserFolders
-
Comment-based help documentation added for the following public functions:
New-UserProfileObject
Remove-RegistryKeyForSID
Remove-ProfilesForSIDs
Get-RegistryKeyForSID
Get-SIDProfileInfo
Get-ProfilePathFromSID
Test-FolderExists
Test-OrphanedProfile
Test-SpecialAccount
-
Implemented and completed Unit Tests for private functions
-
Get-UserFolders
-
Added error handling using a
try
/catch
block to ensure that ifGet-ChildItem
fails (e.g., due to permission issues), the function logs an error message and
returns an empty array instead of throwing an unhandled exception. -
Implemented an
OutputType
attribute for better PowerShell function introspection
and to clearly indicate that the function returns an array of[PSCustomObject]
.
-
-
Invoke-UserProfileAudit
Supporting Functions:-
These supporting functions are now utilized within
Invoke-UserProfileAudit
to audit user profiles from both the file system and registry sources.-
Process-RegistryProfiles
:- Processes profiles retrieved from the registry,
compares them with folder profiles, and identifies orphaned profiles.
- Processes profiles retrieved from the registry,
-
Process-FolderProfiles
:- Processes user profiles from the folder system,
identifies those without corresponding registry entries, and marks them as orphaned.
- Processes user profiles from the folder system,
-
Test-ComputerReachability
:- Encapsulates the common behavior of
Test-ComputerPing
to check if a computer
is reachable before proceeding with operations like profile audits. This ensures
consistent handling of unreachable computers across different functions.
- Encapsulates the common behavior of
-
-
Changed
-
Moved
Get-SIDProfileInfo
to the private functions folder. It will serve as
an internal function forGet-RegistryUserProfiles
-
Get-SIDProfileInfo
-
Returns an empty array
@()
when no registry
key or SIDs are found, improving handling for cases where there are no profiles. -
Improved error handling to ensure proper error messages when the registry key
or subkeys cannot be opened. -
Enhanced handling of SIDs that are invalid or missing a
ProfileImagePath
,
logging appropriate warnings or verbose messages. -
Optimized function behavior to handle scenarios with no SIDs, invalid SID formats,
and missingProfileImagePath
values gracefully.
-
-
Get-UserFolders
-
The function now logs errors when folder retrieval fails, improving diagnostic
feedback. -
The default value for the
ComputerName
parameter is set to$env:COMPUTERNAME
,
ensuring local computer behavior by default without requiring the user to
specify it manually. -
Refined the
Get-DirectoryPath
call to ensure path conversion consistency
across local and remote environments. -
General code clean-up and improved resilience, returning an empty array when
no folders are found or in case of failure, rather than proceeding
without valid data.
-
-
Get-UserProfilesFromRegistry
-
Added error handling using a
try-catch
block to capture and log errors
during the retrieval of registry profiles. -
Implemented a check using
Test-ComputerPing
to verify if the target computer
is online or reachable before attempting to retrieve registry profiles. -
Returns an empty array
@()
when the target computer is offline or unreachable,
logging a warning in such cases. -
Returns an empty array
@()
when an error occurs while accessing the registry
profiles, logging an error message. -
Integrated with the
-ErrorAction Stop
parameter when callingGet-SIDProfileInfo
,
ensuring that errors are caught and handled appropriately in the calling function.
-
-
Get-UserProfilesFromFolders
-
Added error handling using a
try-catch
block to capture and log errors
during the retrieval of user profile folders. -
Implemented a check using
Test-ComputerPing
to verify if the target
computer is online or reachable before attempting to retrieve user folders. -
Returns an empty array
@()
when the target computer is offline or
unreachable, logging a warning in such cases. -
Returns an empty array
@()
when an error occurs while accessing the user
folders, logging an error message.
-
-
Invoke-UserProfileAudit
- Renamed the previous
Get-AllUserProfiles
function toInvoke-UserProfileAudit
. - Added
Get-AllUserProfiles
as an alias forInvoke-UserProfileAudit
to maintain backward compatibility.
- Renamed the previous
Removed
-
Removed the old
Get-AllUserProfiles
function and replaced it with the new
Invoke-UserProfileAudit
function. -
Temporarily Removed functions (
Remove-OrphanedProfiles
and
Remove-ProfilesForSIDs
) related to Removing Users Folders and registry
keys for further testing before implementing
v0.2.0-preview0003
[v0.2.0-preview0003]
Added
-
Added core functions
-
configured
WinRegOps
as a dependant module -
Updated build file for release
-
Comment-based help documentation added for the following public functions:
Get-AllUserProfiles
Get-OrphanedProfiles
Remove-OrphanedProfiles
Remove-SIDProfile
Get-UserProfileFolders
Get-RegistryUserProfiles
Get-UserFolders
-
Comment-based help documentation added for the following public functions:
New-UserProfileObject
Remove-RegistryKeyForSID
Remove-ProfilesForSIDs
Get-RegistryKeyForSID
Get-SIDProfileInfo
Get-ProfilePathFromSID
Test-FolderExists
Test-OrphanedProfile
Test-SpecialAccount
-
Implemented and completed Unit Tests for private functions
-
Get-UserFolders
-
Added error handling using a
try
/catch
block to ensure that ifGet-ChildItem
fails (e.g., due to permission issues), the function logs an error message and
returns an empty array instead of throwing an unhandled exception. -
Implemented an
OutputType
attribute for better PowerShell function introspection
and to clearly indicate that the function returns an array of[PSCustomObject]
.
-
-
Invoke-UserProfileAudit
Supporting Functions:-
These supporting functions are now utilized within
Invoke-UserProfileAudit
to audit user profiles from both the file system and registry sources.-
Process-RegistryProfiles
:- Processes profiles retrieved from the registry,
compares them with folder profiles, and identifies orphaned profiles.
- Processes profiles retrieved from the registry,
-
Process-FolderProfiles
:- Processes user profiles from the folder system,
identifies those without corresponding registry entries, and marks them as orphaned.
- Processes user profiles from the folder system,
-
Test-ComputerReachability
:- Encapsulates the common behavior of
Test-ComputerPing
to check if a computer
is reachable before proceeding with operations like profile audits. This ensures
consistent handling of unreachable computers across different functions.
- Encapsulates the common behavior of
-
-
Changed
-
Moved
Get-SIDProfileInfo
to the private functions folder. It will serve as
an internal function forGet-RegistryUserProfiles
-
Get-SIDProfileInfo
-
Returns an empty array
@()
when no registry
key or SIDs are found, improving handling for cases where there are no profiles. -
Improved error handling to ensure proper error messages when the registry key
or subkeys cannot be opened. -
Enhanced handling of SIDs that are invalid or missing a
ProfileImagePath
,
logging appropriate warnings or verbose messages. -
Optimized function behavior to handle scenarios with no SIDs, invalid SID formats,
and missingProfileImagePath
values gracefully.
-
-
Get-UserFolders
-
The function now logs errors when folder retrieval fails, improving diagnostic
feedback. -
The default value for the
ComputerName
parameter is set to$env:COMPUTERNAME
,
ensuring local computer behavior by default without requiring the user to
specify it manually. -
Refined the
Get-DirectoryPath
call to ensure path conversion consistency
across local and remote environments. -
General code clean-up and improved resilience, returning an empty array when
no folders are found or in case of failure, rather than proceeding
without valid data.
-
-
Get-UserProfilesFromRegistry
-
Added error handling using a
try-catch
block to capture and log errors
during the retrieval of registry profiles. -
Implemented a check using
Test-ComputerPing
to verify if the target computer
is online or reachable before attempting to retrieve registry profiles. -
Returns an empty array
@()
when the target computer is offline or unreachable,
logging a warning in such cases. -
Returns an empty array
@()
when an error occurs while accessing the registry
profiles, logging an error message. -
Integrated with the
-ErrorAction Stop
parameter when callingGet-SIDProfileInfo
,
ensuring that errors are caught and handled appropriately in the calling function.
-
-
Get-UserProfilesFromFolders
-
Added error handling using a
try-catch
block to capture and log errors
during the retrieval of user profile folders. -
Implemented a check using
Test-ComputerPing
to verify if the target
computer is online or reachable before attempting to retrieve user folders. -
Returns an empty array
@()
when the target computer is offline or
unreachable, logging a warning in such cases. -
Returns an empty array
@()
when an error occurs while accessing the user
folders, logging an error message.
-
-
Invoke-UserProfileAudit
- Renamed the previous
Get-AllUserProfiles
function toInvoke-UserProfileAudit
. - Added
Get-AllUserProfiles
as an alias forInvoke-UserProfileAudit
to maintain backward compatibility.
- Renamed the previous
Removed
-
Removed the old
Get-AllUserProfiles
function and replaced it with the new
Invoke-UserProfileAudit
function. -
Temporarily Removed functions (
Remove-OrphanedProfiles
and
Remove-ProfilesForSIDs
) related to Removing Users Folders and registry
keys for further testing before implementing
v0.2.0-preview0002
[v0.2.0-preview0002]
Added
-
Added core functions
-
configured
WinRegOps
as a dependant module -
Updated build file for release
-
Comment-based help documentation added for the following public functions:
Get-AllUserProfiles
Get-OrphanedProfiles
Remove-OrphanedProfiles
Remove-SIDProfile
Get-UserProfileFolders
Get-RegistryUserProfiles
Get-UserFolders
Get-SIDProfileInfo
-
Comment-based help documentation added for the following public functions:
-
New-UserProfileObject
-
Remove-RegistryKeyForSID
-
Remove-ProfilesForSIDs
-
Get-RegistryKeyForSID
-
Get-ProfilePathFromSID
-
Test-FolderExists
-
Test-OrphanedProfile
-
Test-SpecialAccount
-
Implemented and completed Unit Tests for private functions