IIS配置(安装IIS、.Net、更改IIS Log目录位置)

 

#安装IIS、.NetFramework 3.5
Import-Module servermanager
Get-WindowsFeature web-* | ? {$_.Name -ne "Web-WHC" -and $_.Name -ne "Web-Ftp-Server" -and $_.Name -ne "Web-Ftp-Ext" -and $_.Name -ne "Web-Ftp-Service" -and $_.Name -ne "Web-Custom-Logging" -and $_.Name -ne "Web-ODBC-Logging" -and $_.Name -ne "Web-Client-Auth" -and $_.Name -ne "Web-Cert-Auth" -and $_.Name -ne "Web-DAV-Publishing"} | Add-WindowsFeature
Add-WindowsFeature NET-Framework,WAS -IncludeAllSubFeature

#新建wwwroot目录
cmd /c "md D:\wwwroot"

#删除默认站点
Import-Module webadministration
Remove-Website -Name "Default Web Site"

#更改IISLog位置到 D:\IISLog
cmd /c "md D:\IISlog"
$iislogdir = "D:\IISLog"
Set-WebConfigurationProperty "/system.applicationHost/sites/siteDefaults" -name logfile.directory -value $iislogdir

 

更改单个站点的IIS Log位置:

New-ItemProperty IIS:\Sites\MyNewSite -name logging -value @{format='W3C';directory='d:\sites\site\logs';encoding=UTF-8}

 

posted on 2015-06-30 16:41  momingliu11  阅读(1289)  评论(0编辑  收藏  举报