pliancy / occam

O365 Configuration Compliance Audit Manager
https://github.com/pliancy/occam
MIT License
32 stars 6 forks source link

Error pops up when discovering rules in the C:\Windows\System32 dir #3

Open CalebAlbers opened 3 years ago

CalebAlbers commented 3 years ago

PowerShell prompts that are launched as Administrator default to C:\Windows\System32 as the working directory. When OCCAM attempts to discovery .Rule.ps1 files, it does so recursively, which can return errors when attempting to search parts of System32 that the PowerShell process does not have access to.

We can either:

  1. Warn users when running in C:\Windows\System32 that they need to run OCCAM somewhere else
  2. Add a special case that does a non-recursive search in C:\Windows\System32
  3. Catch and silence the errors when in C:\Windows\System32