Ceate VirtualDirectory or Application in IIS6 or IIS7 Vir Command Line

▼魔方 西西 提交于 2020-02-06 05:22:07

直接上代码 你懂得

 1 @echo off
 2 color 17
 3 Title My Standard IIS 6.0 Configuration . . .
 4 
 5 :: ****************************************
 6 SET VDirName=MyTest
 7 SET dir=C:\Inetpub\AdminScripts
 8 SET dd=Login.aspx
 9 SET PhysicalWebPath=D:\AOS\Publish\AOS.Web
10 SET AppPoolName=DefaultAppPool
11 :: ****************************************
12 
13 :: ========================================
14 ::   STEP 1: CREATE VIRTUAL DIRECTORY
15 :: ========================================
16 echo Creating Virtual Directory . . .
17 echo ------------------------------------------------------------
18 REM IIS 6 
19 REM CSCRIPT //nologo %systemroot%\system32\IISvdir.vbs /create "Default Web Site" "%VDirName%" %PhysicalWebPath%
20 REM IIS 7
21 CSCRIPT //nologo %dir%\adsutil.vbs create w3svc/1/Root/%VDirName% "IIsWebVirtualDir"
22 CSCRIPT //nologo %dir%\adsutil.vbs SET w3svc/1/Root/%VDirName%/Path %PhysicalWebPath%
23 echo.
24 
25 :: ========================================
26 ::   STEP 2: SET DEFAULT DOCUMENT
27 :: ========================================
28 echo Setting Default Documents . . .
29 echo ------------------------------------------------------------
30 CSCRIPT //nologo %dir%\adsutil.vbs SET w3svc/1/Root/%VDirName%/DefaultDoc %dd%
31 echo.
32 
33 :: ========================================
34 ::   STEP 3: ASSIGN APPLICATION POOL TO VIRDIR
35 :: ========================================
36 echo Assigning Application Pool to Virtual Directory . . .
37 echo ------------------------------------------------------------
38 CSCRIPT //nologo %dir%\adsutil.vbs SET w3svc/1/Root/%VDirName%/AppPoolid %AppPoolName%
39 echo.
40 
41 :: ========================================
42 ::   STEP 4: Enable DirBrowsing
43 :: ========================================
44 echo Enable DirBrowsing . . .
45 echo ------------------------------------------------------------
46 CSCRIPT //nologo %dir%\adsutil.vbs SET w3svc/1/Root/%VDirName%/EnableDirBrowsing True
47 echo.
48 
49 :: ========================================
50 ::   STEP 5: Disable AuthNTLM
51 :: ========================================
52 echo Disable AuthNTLM . . .
53 echo ------------------------------------------------------------
54 CSCRIPT //nologo %dir%\adsutil.vbs SET w3svc/1/Root/%VDirName%/AuthNTLM False
55 echo.
56 
57 :: ========================================
58 ::   STEP 6: Enable DontLog
59 :: ========================================
60 echo Enable DontLog . . .
61 echo ------------------------------------------------------------
62 CSCRIPT //nologo %dir%\adsutil.vbs SET w3svc/1/Root/%VDirName%/DontLog True
63 echo.
64 
65 :: ========================================
66 ::   STEP 7: Disable ContentIndexed
67 :: ========================================
68 echo Disable ContentIndexed . . .
69 echo ------------------------------------------------------------
70 CSCRIPT //nologo %dir%\adsutil.vbs SET w3svc/1/Root/%VDirName%/ContentIndexed False
71 echo.
72 PAUSE

 

Metabase Reference : http://msdn.microsoft.com/en-us/library/aa347565(v=vs.90).aspx

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!