nexxai / CryptoBlocker

A script to deploy File Server Resource Manager and associated scripts to block infected users
GNU General Public License v2.0
200 stars 73 forks source link

PowerShell only for Server 2012+ #28

Open ruddj opened 6 years ago

ruddj commented 6 years ago

A powershell version that uses the native powershell FSRM commands. It is designed to allow it to be easily run automatically from a scheduled task. This would more be an alternative or branch version rather than replace original as the FSRM powershell commands do not exist for Server 2008 / 2008 R2

Changes: Replaced filescrn.exe with Powershell commands to remove the depreciated warnings. Added support for a proxy server between script and web Changed to more compatible Write-Output statements to allow redirection of output for logs Made skip list defined variable as needs to be full path when run as scheduled task. Added Transcript option to create log files of run.

davidande commented 6 years ago

I also use fsrm commands on my scripts

nexxai commented 6 years ago

Before I merge, I have a question for the community: should we be creating a separate method of storing personal preferences (registry/config file/etc) since manually editing the .ps1 files will get overwritten the next time the script is updated.

And if separate is the way to go, what do people prefer?

My personal preference (and absolutely NOT necessarily the way we will go, just my personal insight) would be to have the script either prompt on first run for the necessary values and dump them into the registry somewhere to be read back later, or allow command-line switches to overwrite the stored values.

The downside to this is that the script may break for a certain number of people if they have a git clone set up to automatically get the latest version of the script before running, since when the change is made, the script will be sitting there waiting for user input and never go anywhere.

Thoughts?

ruddj commented 6 years ago

The best way may be to define the entire script and options the proper powershell way with defined parameters. I would much rather that than registry entries as in my case we run the script from a shared UNC path and have a failover cluster scheduled task run it once a week. This means it runs from multiple servers with no user interaction.

I will work on making it a proper powershell module and post updated pull soon. Cheers,

ruddj commented 6 years ago

Hopefully this should have parameterised all the options.

JustinCochran commented 6 years ago

Would it be possible to then put in a parameter called "FirstRun" or something like that. If the Parameter is set then it will verify that FSRM is installed and also setup the Server Options (E.G. SMTP Server, Default Admin Recipients, Default From Recipient) Then if the parameter is not set the script would just run the update portions. Could speed up the process.

nexxai commented 5 years ago

@ruddj I am extremely sorry - I'm not sure how I missed this PR, but if you can resolve the conflicts, I will merge it immediately.