Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Shall script-iis

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Servermanagercmd-I Web-WebServer Web-Mgmt-Console Web-Scripting-Tools # installs the IIS default role and administrative console

[system.reflection.assembly]:: loadwithpartialname ("Microsoft.Web.Administration") # call dotnet Framework web management assembly

$sitename= "benet" # set the site name

$sitepath= "c:\ benet" # set the local folder of the site

$siteip= "192.168.10.40" # set up the new site IP

$vd= "/ prd" # defines the virtual directory name

$vdpath= "c:\ product" # defines the physical path to the virtual directory

$web=new-object microsoft.web.administration.servermanager # New web Management set servermanager object

$site=$web.sites # assigns all sites on the server object to the $site object

# Test the local folder, and if the c:\ benet folder does not exist, create

If (! (test-path $sitepath))

{

New-Item $sitepath-itemtype directory

}

# create a new site named benet, using http access protocol, port 80, and hostname www.benet.com

$site.psbase.add ($sitename, "http", $siteip+ ": 80:www.benet.com", $sitepath)

$web.commitchanges ()

# create a new virtual directory on the benet site, named prd, and the physical path is c:\ product

$web=new-object microsoft.web.administration.servermanager

$site=$web.sites |? {$_ .name-eq $sitename}

$app=$site.Applications |? {$_ .ApplicationPoolName-eq "DefaultAppPool"}

If (! (test-path $vdpath))

{

New-Item $vdpath-ItemType directory

}

$app.VirtualDirectories.add ($vd,$vdpath)

$web.commitchanges ()

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report