您的位置:首页 > 数据库

Sqlserver2008+IIS7.5 自动安装恢复及发部WEB

2013-03-13 16:52 239 查看
本文意在方便的部署一个WEB程序,故学写一个SHELL(俗称一下)
注:本次实验为 WINDOWS SERVER2008R2+Sqlserver2008(developer)+IIS7.5+ASP.NET
有啥米问题QQ:285979593留言哒
@echo offset current_path=%~dp0set hostname=WIN-S43U30SI4GQset INSTALLSQLDATADIR=c:\MSSQL2008set INSTANCENAME=fkfjset PASSWORD=IBM-Password2012set restoredbname=dayunoatargetset disk=%~dp0oatarget.bakREM --------------------------------IIS变量set sitename=dayunset siteport=80set sitephysicalpath=c:\oa:initmkdir %INSTALLSQLDATADIR%mkdir %sitephysicalpath%if exist c:\setup.txt (goto setup) else goto check:setupfor /f  %%i  in (c:\setup.txt) do (ECHO %%iif "%%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 exitREM ------------------------------------------------------NET组件安装:STEP1echo STEP2> c:\setup.txtreg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v autoinstall /d "%current_path%auto_install.bat" /fServerManagerCmd -install NET-Framework -allSubFeaturesSetup.exe /QSshutdown -r -t 0goto exitREM ------------------------------------------------------数据库安装:STEP2echo STEP3>c:\setup.txtSetup.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>nulshutdown -r -t 0goto exitREM ------------------------------------------------------数据库恢复:STEP3echo STEP4>c:\setup.txtping 127.1 -n 20 >nul 2>nulosql -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-ConfigurationAPIping 127.1 -n 20 >nul 2>nulshutdown -r -t 0goto exitREM ------------------------------------------------------开启数据库SA权限及IIS安装:STEP4echo STEP5>c:\setup.txtreg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.FKFJ\MSSQLServer /v LoginMode /t REG_DWORD /d 2 /fping 127.1 -n 20 >nul 2>nulosql -E -S .\fkfj -Q "ALTER LOGIN sa WITH PASSWORD ='%PASSWORD%'"osql -E -S .\fkfj -Q "ALTER LOGIN sa ENABLE"net stop mssql$fkfjnet start mssql$fkfjpkgmgr /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-ConfigurationAPIshutdown -r -t 0goto exitREM ------------------------------------------------------拷贝文件及IIS发布:STEP5echo FINISH>c:\setup.txtrobocopy %current_path%BPObject %sitephysicalpath% /EC:\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:truenet start aspnet_stategoto exitREM ------------------------------------------------------:checkecho 配制文件不存在echo STEP1>c:\setup.txtgoto initREM ------------------------------------------------------:exit

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: