I need to get the write protection status of C: drive using ewfmgr
and enable the write protection if it is currently disabled.
I understand that the following command can give me the status of C: drive on CMD window
ewfmgr c:
but how do I store the value in a variable and check if the write proctection is currently disabled?
I need the following (pseudocode):
currentStatus = Somehow get the status of C:
if currentStatus = disable
ewfmgr -enable
shutdown -r
In PowerShell simply pass the output of
ewfmgr C:
through aWhere-Object
filter:In batch use
findstr
in afor
loop: