decrpt.bat:
@echo off
Set WEB_CONFIG_PATH=D:\webconfigSet DotNetPath=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727::Copy to local folder
copy %WEB_CONFIG_PATH%\Web.config Web.config /Y:: Decrypt local Web.config
%DotNetPath%\aspnet_regiis -pdf "system.web/identity" %cd%%DotNetPath%\aspnet_regiis -pdf "connectionStrings" %cd%%DotNetPath%\aspnet_regiis -pdf "appSettings" %cd%:: Backup the decrypt web.config file
set datestr=%date:/=-%set datestr=%datestr: =-%Set BackupFileName=Web_Dec_%datestr%.configcopy Web.config %BackupFileName% /-Y:: backup endPAUSE
encrpt.bat:
@echo off
Set WEB_CONFIG_PATH=D:\webconfigset keyContainerName=pm_WEB_CODEset DotNetPath=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727:: Encrypt local file
%DotNetPath%\aspnet_regiis -pef "system.web/identity" %cd% -prov %keyContainerName%%DotNetPath%\aspnet_regiis -pef "connectionStrings" %cd% -prov %keyContainerName%%DotNetPath%\aspnet_regiis -pef "appSettings" %cd% -prov %keyContainerName%:: Authorization
%DotNetPath%\aspnet_regiis -pa %keyContainerName% "Users" :: Update the live filemove /Y Web.config %WEB_CONFIG_PATH%PAUSE