2013-01-14 38 views
0

我正在嘗試使用腳本安裝應用程序。此應用程序在IIS中的默認網站下創建一個虛擬目錄。 我已經寫了這個腳本。這是正確的腳本還是我錯過了一些東西。使用命令行寫入IIS

cd C:\Users\Administrator\Desktop 
msiexec /qb /i ZFPSetup.msi INSTALLLOCATION="C:\Program Files (x86)\Application" TARGETVDIR="ZFP" WIXUI_EXITDIALOGOPTIONALCHECKBOX=1 /l*v "C:\log.txt" 
iisvdir /create Default Web Site ZFP C:\Program Files (x86)\Application\ZFP 
call "C:\Program Files (x86)\Application\StartKaraf.bat" echo error 

我得到以下錯誤:

MSI (s) (28:D0) [04:25:58:897]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIF886.tmp, Entrypoint: WriteIIS7ConfigChanges 
WriteIIS7ConfigChanges: Error 0x80070002: Site not found for create application 
WriteIIS7ConfigChanges: Error 0x80070002: Failed to configure IIS application. 
WriteIIS7ConfigChanges: Error 0x80070002: WriteIIS7ConfigChanges Failed. 
CustomAction WriteIIS7ConfigChanges returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) 

回答

0

使用簡單的批處理文件是不是最好的方式去配置IIS。對於這樣的系統管理任務,Microsoft創建了PowerShell

看看如何使用PowerShell在這裏配置IIS:http://www.iis.net/learn/manage/powershell

下面是如何使用PowerShell在IIS中創建一個虛擬目錄的例子:

PS IIS:\> New-Item 'IIS:\Sites\Default Web Site\DemoVirtualDir1' -type VirtualDirectory -physicalPath c:\test\virtualDirectory1 

上面的代碼使用PowerShell Snap-In for Creating Applications

祝你好運!

+0

我不擅長的PowerShell。我從某處獲得了這個腳本。如果我必須包含以上功能+卸載和安裝,我需要對此腳本做些什麼更改。你能幫忙嗎? –

+0

劇本太長而無法過去。你可以給我一個PowerShell腳本。 –

0

Error 0x80070002: Site not found for create application

也許這是由缺乏引號引起的,所以不是:

... iisvdir /create Default Web Site ...

嘗試:

... iisvdir /create "Default Web Site" ...