本文意在方便的部署一个WEB程序,故学写一个SHELL(俗称一下)
注:本次实验为 WINDOWS SERVER2008R2+sqlserver2008(developer)+IIS7.5+ASP.NET
有啥米问题QQ:285979593留言哒
@echo off set current_path=%~dp0 set hostname=WIN-S43U30SI4GQ set INSTALLsqlDATADIR=c:\MSsql2008 set INSTANCENAME=fkfj set PASSWORD=IBM-Password2012 set restoredbname=dayunoatarget set disk=%~dp0oatarget.bak REM --------------------------------IIS变量 set sitename=dayun set siteport=80 set sitephysicalpath=c:\oa :init mkdir %INSTALLsqlDATADIR% mkdir %sitephysicalpath% if exist c:\setup.txt (goto setup) else goto check :setup for /f %%i in (c:\setup.txt) do (ECHO %%i if "%%i" == "STEP1" (goto STEP1) if "%%i" == "STEP2" (goto STEP2) if "%%i" == "STEP3" (goto STEP3) if "%%i" == "STEP4" (goto STEP4) if "%%i" == "STEP5" (goto STEP5) ) goto exit REM ------------------------------------------------------NET组件安装 :STEP1 echo STEP2> c:\setup.txt reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v autoinstall /d "%current_path%auto_install.bat" /f ServerManagerCmd -install NET-Framework -allSubFeatures Setup.exe /QS shutdown -r -t 0 goto exit REM ------------------------------------------------------数据库安装 :STEP2 echo STEP3>c:\setup.txt Setup.exe /QS /ACTION=Install /SkipRules=VSShellInstalledRule /IAcceptsqlServerLicenseTerms="True" /FEATURES=sqlEngine,IS,SSMS /INSTANCENAME=%INSTANCENAME% /INSTALLsqlDATADIR="%INSTALLsqlDATADIR%" /sqlSVCACCOUNT="NT AUTHORITY\SYstem" /SAPWD="IBM-Yunsoft2012" /sqlSYSADMINACCOUNTS="%hostname%\ADMINISTRATOR" /AGTSVCACCOUNT="NT AUTHORITY\SYstem" ping 127.1 -n 10 >nul 2>nul shutdown -r -t 0 goto exit REM ------------------------------------------------------数据库恢复 :STEP3 echo STEP4>c:\setup.txt ping 127.1 -n 20 >nul 2>nul osql -E -S .\%INSTANCENAME% -Q "restore database %restoredbname% from disk = '%disk%' with move 'UCMLOASESTarget' to '%INSTALLsqlDATADIR%\MSsql10_50.%INSTANCENAME%\MSsql\DATA\UCMLOAEnv_090527.mdf',move 'UCMLOASESTarget_log' to '%INSTALLsqlDATADIR%\MSsql10_50.%INSTANCENAME%\MSsql\DATA\UCMLOAEnv_090527_log.ldf'" pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-Directorybrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-requestfiltering;IIS-IPSecurity;IIS-Performance;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI ping 127.1 -n 20 >nul 2>nul shutdown -r -t 0 goto exit REM ------------------------------------------------------开启数据库SA权限及IIS安装 :STEP4 echo STEP5>c:\setup.txt reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft sql Server\MSsql10_50.FKFJ\MSsqlServer /v LoginMode /t REG_DWORD /d 2 /f ping 127.1 -n 20 >nul 2>nul osql -E -S .\fkfj -Q "ALTER LOGIN sa WITH PASSWORD ='%PASSWORD%'" osql -E -S .\fkfj -Q "ALTER LOGIN sa ENABLE" net stop mssql$fkfj net start mssql$fkfj pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-Directorybrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-requestfiltering;IIS-IPSecurity;IIS-Performance;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI shutdown -r -t 0 goto exit REM ------------------------------------------------------拷贝文件及IIS发布 :STEP5 echo FINISH>c:\setup.txt robocopy %current_path%BPObject %sitephysicalpath% /E C:\Windows\System32\inetsrv\appcmd.exe add site /name:"%sitename%" /bindings:http://localhost:%siteport% /physicalpath:%sitephysicalpath% C:\Windows\System32\inetsrv\appcmd.exe set apppool /apppool.name:DefaultAppPool /enable32BitAppOnWin64:true net start aspnet_state goto exit REM ------------------------------------------------------ :check echo 配制文件不存在 echo STEP1>c:\setup.txt goto init REM ------------------------------------------------------ :exit
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。