invictus-ir/Microsoft-Extractor-Suite

Get-*Rules - Directory Issues

Closed this issue · 2 comments

Problem
When using Get-TransportRules or, Get-MailboxRules with no directory, it is pulling the directory from which the module was imported.

When using the -outputdirectory command line parameter, there is no check to ensure the directory is valid. Additionally, the string is treated literally, so when using -outputdirectory . it will create a file called .mailbox_rules.csv. Finally, the outputdirectory command line has no date field

Expected Behavior
When using Get-*Transport rules, it uses the powershell default of $pwd (Built in variable), instead of the module directory. Similar to Get-Unified Audit Log

When using the -outputdirectory command line, its best practice to make sure the output directory is set properly and test it exists, incase the user did not enter the right path. If an invalid directory is passed, it should exit before collecting the data to avoid inconvenience to the end user.

Hi, thank you for the feedback once again. We have accepted your pull request, and we really appreciate it. We will review all the other modules to incorporate this output directory validation since I don't believe it exists yet.

The output validation is added to all the functions:)