TheTaylorLee / AdminToolbox

Repository for the AdminToolbox PowerShell Modules
MIT License
186 stars 22 forks source link

Admintoolbox.FileManagement - Remove-DisabledADProfiles - Delete Method susceptible to failures #77

Closed TheTaylorLee closed 2 years ago

TheTaylorLee commented 2 years ago

Environment

Describe the bug The delete method invocation used by this function doesn't work in the greater majority of environments.

Expected behavior This function should work where PowerShell 5+ is installed and remove local accounts when run if those domain accounts are disabled.

Error Message If applicable, add error messages to help explain your problem.

Additional context Consider alternative methods to handle this process. Perhaps use Try/catch or if/else to invoke different methods dependents on the environment.

TheTaylorLee commented 2 years ago

Converted the function to use cim instead of wmi. I believe this is going to provide much better compatibility across environments.