开发者

How to make a created virtual directory in IIS6.0 as application using powershellv2.0

HI i created some virtual directories in my iis using following code

Function InputBox ($message, $title, $default)
{
    [void][reflection.assembly]::loadwithpartialname("microsoft.visualbasic")
    $result = [mi开发者_如何学Ccrosoft.visualbasic.interaction]::InputBox($message,$title, $default)

    return $result
}

$server=inputbox("enter the name of the server")
$iis=[adsi]"IIS://$($server)/W3SVC/1/Root"
$vdirname=inputbox("enter the name of virtual directory","","")
$vd = $iis.psbase.children.Add($vdirname,"IISWebVirtualDir")
$vdirpath=inputbox("enter the physical location of the application")
$vd.put("Path",$vdirpath)
$vd.psbase.CommitChanges()

but i am unable to create it as an application can any one help me out in this issue. for creating it as an application i am going into the properties of the virtual directory and in the virtual derctory tab in the application sessions, i clicked on "create" button and then application got created.

can any one help me with a powershell code that will create an application Thanks, Ramuk Navap


Use the WebAdministration module that comes with PowerShell 2.0:

Import-Module WebAdministration
New-WebVirtualDirectory -Site "Default Web Site" -Name ContosoVDir `
                        -PhysicalPath c:\inetpub\contoso

If you copy/paste this make sure there is no additional whitespace after the line continuation character - (`).


http://arcware.net/creating-iis-applications-with-powershell

http://learn.iis.net/page.aspx/433/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜