För några dagar sedan behövde jag skapa ett skript som skulle kryptera mappar för mina slutanvändare på jobbet. Jag skrev koden nedan och slängde den sedan i ett inloggningsskript som sedan skulle köras när mina användare loggade in på sina system. Syftet med kryptering är att skydda känslig företagsdata som lagras på stationära och bärbara datorer. Även om processen fungerade för mig, rekommenderar jag att du testar den noggrant innan du distribuerar!

Koden nedan är en enkel process som gör några saker:

  1. Krypterar all data i den inloggade användarens My Documents.
  2. Krypterar all data i den inloggade användarens Outlook. Detta är standardplatsen för Outlook 2000 och Outlook 2003 för att lagra .ost- och .pst-filer.
  3. Pipear all utdata från skriptet till en fil för senare insamling. Filen kan finnas under den inloggade användarens My documents. Filen kommer att heta %computername%.efs.

Windows XP

REM @echo off
REM EFS MyDoc & Outlook EFS Encryption Script Version 1.1
REM https://www.groovypost.com
REM
REM Script Created by MrGroove (Geekolar.com)
REM
REM This program is free software; not to be redistributed
REM without permission of Geekolar.com
REM
echo ***** >> "%userprofile%my documents%computername%.efs"
REM EFS Encryption Script Version 1.1
REM ======================================================
REM First, let's create a file to store all the work were doing and for history
echo ****** >> "%userprofile%my documents%computername%.efs"
echo ****** >> "%userprofile%my documents%computername%.efs"
REM ======================================================
echo %date% %time% >> "%userprofile%My documents%computername%.efs"
REM ===================================================
REM Now were going to update all files to ensure no files are encrypted with old keys
cipher /u >> "%userprofile%My documents%computername%.efs"
REM ===================================================
REM Begin encryption of the "My Documents" folder
cipher /a /e /h /i /q /s:"%userprofile%My Documents"
>> "%userprofile%My documents%computername%.efs"
REM ======================================================
REM Begin encrption of the "Outlook" folder where the OST and PST files are stored
cipher /a /e /h /i /q /s:"%userprofile%Local SettingsApplication DataMicrosoftOutlook" 
>> "%userprofile%My documents%computername%.efs"
REM ==================================================
REM More House Keeping
echo %date% %time% >> "%userprofile%My documents%computername%.efs"
echo ****** >> "%userprofile%My documents%computername%.efs"
echo ****** >> "%userprofile%My documents%computername%.efs"
REM ==================================================
REM ==================================================
REM All Done!

Windows 7

REM @echo off
REM EFS MyDoc & Outlook EFS Encryption Script Version 1.1
REM https://www.groovypost.com
REM
REM Script Created by MrGroove (Geekolar.com)
REM
REM This program is free software; not to be redistributed
REM without permission of Geekolar.com
REM
echo ***** >> "%userprofile%documents%computername%.efs"
REM EFS Encryption Script Version 1.1
REM ======================================================
REM First, let's create a file to store all the work were doing and for history
echo ****** >> "%userprofile%documents%computername%.efs"
echo ****** >> "%userprofile%documents%computername%.efs"
REM ======================================================
echo %date% %time% >> "%userprofile%documents%computername%.efs"
REM ===================================================
REM Now were going to update all files to ensure no files are encrypted with old keys
cipher /u >> "%userprofile%documents%computername%.efs"
REM ===================================================
REM Begin encryption of the "Documents" folder
cipher /a /e /h /i /q /s:"%userprofile%Documents" >> 
"%userprofile%documents%computername%.efs"
REM ======================================================
REM Begin encrption of the "Outlook" folder where the OST and PST files are stored
cipher /a /e /h /i /q /s:"%userprofile%Local SettingsApplication DataMicrosoftOutlook" >> 
"%userprofile%documents%computername%.efs"
REM ==================================================
REM More House Keeping
echo %date% %time% >> "%userprofile%documents%computername%.efs"
echo ****** >> "%userprofile%documents%computername%.efs"
echo ****** >> "%userprofile%documents%computername%.efs"
REM ==================================================
REM ==================================================
REM All Done!
Rate this post
Previous articleHur man rengör startar Windows 11
Next articleHur man använder autofyll på Apple TV och iOS-enhet för enkla inloggningar