Microsoft TechDays Дмитрий Сотников MVP Quest Software

Preview:

Citation preview

Microsoft TechDayshttp://www.techdays.ru

Управление IIS с помощью PowerShell

Дмитрий СотниковMVPQuest Software

Microsoft TechDayshttp://www.techdays.ru

IIS и PowerShell

Где взятьЧто в нем естьДемонстрация

Microsoft TechDayshttp://www.techdays.ru

Установка

PowerShellВерсия 1.0 входит в Windows Server 2008Server Manager / Features / Add Features / Windows PowerShell

IIS ProviderТребует самостоятельной загрузки с www.iis.net

Microsoft TechDayshttp://www.techdays.ru

Что внутри

ПровайдерПредставляет веб-сервер как дополнительный диск

Кмдлеты72 команды

Microsoft TechDayshttp://www.techdays.ru

WebConfiguration

Add-WebConfigurationClear-WebConfigurationGet-WebConfigurationSelect-WebConfigurationSet-WebConfiguration

Add-WebConfiguration //defaultDocument/files "IIS:\sites\Default Web Site" -at 0 -value @{value="new-index.html"}

Microsoft TechDayshttp://www.techdays.ru

WebConfigurationBackup

Backup-WebConfigurationGet-WebConfigurationBackupRemove-WebConfigurationBackupRestore-WebConfiguration

Backup-WebConfiguration MyBackupRestore-WebConfiguration -Name MyBackup

Microsoft TechDayshttp://www.techdays.ru

WebGlobalModule

Disable-WebGlobalModuleEnable-WebGlobalModuleGet-WebGlobalModuleNew-WebGlobalModuleRemove-WebGlobalModuleSet-WebGlobalModule

Disable-WebGlobalModule -name FastCgiModule -pspath 'iis:\sites\mysite'

Microsoft TechDayshttp://www.techdays.ru

WebAppPool

New-WebAppPoolRemove-WebAppPoolRestart-WebAppPoolStart-WebAppPoolStop-WebAppPoolGet-WebAppPoolState

New-WebAppPool MyNewAppPoolGet-WebAppPoolState MyNewAppPool

Microsoft TechDayshttp://www.techdays.ru

Website

Get-WebsiteNew-WebsiteNew-WebFtpSiteRemove-WebsiteStart-WebsiteStop-Website

Get-WebsiteState

New-WebFtpSite -name testFtpSite-Port 21-PhysicalPath c:\test-HostHeader mySite-IPAddress 127.0.0.1

Microsoft TechDayshttp://www.techdays.ru

WebHandler

Get-WebHandlerNew-WebHandlerRemove-WebHandlerSet-WebHandler

Set-WebHandler -name StaticFile –Path "*.htm"

Microsoft TechDayshttp://www.techdays.ru

WebManagedModule

Get-WebManagedModuleNew-WebManagedModuleRemove-WebManagedModuleSet-WebManagedModule

Set-WebManagedModule -Name UrlMappingsModule -Type Test.Test

Microsoft TechDayshttp://www.techdays.ru

WebBinding

Get-WebBindingNew-WebBindingRemove-WebBindingSet-WebBinding

Set-WebBinding -name 'Default Web Site'

-BindingInformation "*:80:" -PropertyName Port -Value 1234

Microsoft TechDayshttp://www.techdays.ru

WebConfigurationProperty

Add-WebConfigurationPropertyGet-WebConfigurationPropertyRemove-WebConfigurationPropertySet-WebConfigurationProperty

Set-WebConfigurationProperty "//handlers/add[@path='*.aspx']" -PSPath IIS:\ -name path –value “*.mspx”

Microsoft TechDayshttp://www.techdays.ru

WebApplication

ConvertTo-WebApplicationGet-WebApplicationNew-WebApplicationRemove-WebApplication

New-WebApplication -name testApp -site 'Default Web Site' -PhysicalPath c:\test

-ApplicationPool DefaultAppPool

Microsoft TechDayshttp://www.techdays.ru

WebConfigurationLocation

Get-WebConfigurationLocationRemove-WebConfigurationLocationRename-WebConfigurationLocation

Remove-WebConfigurationLocation -Name "SuperSite/my*"

Get-WebConfigurationLocation -Name "SuperSite" -psPath "IIS:\"

Microsoft TechDayshttp://www.techdays.ru

WebItem

Restart-WebItemStart-WebItemStop-WebItemGet-WebItemState

Restart-WebItem 'IIS:\AppPools\DefaultAppPool'

Microsoft TechDayshttp://www.techdays.ru

WebVirtualDirectory

Get-WebVirtualDirectoryNew-WebVirtualDirectoryRemove-WebVirtualDirectory

Get-WebVirtualDirectory -site 'Default Web Site' -Application testApp

Microsoft TechDayshttp://www.techdays.ru

WebConfigurationLock

Add-WebConfigurationLockGet-WebConfigurationLockRemove-WebConfigurationLock

Add-WebConfigurationLock -type inclusive -Filter //asp/@lcid

Microsoft TechDayshttp://www.techdays.ru

WebCommitDelay

Begin-WebCommitDelayEnd-WebCommitDelay

Begin-WebCommitDelay...End-WebCommitDelay

Microsoft TechDayshttp://www.techdays.ru

WebRequestTracing

Disable-WebRequestTracingEnable-WebRequestTracingClear-WebRequestTracingSettings

Enable-WebRequestTracing -Name "Default Web Site"

Microsoft TechDayshttp://www.techdays.ru

Разное

Get-WebConfigFileGet-WebURLGet-WebFilePathGet-WebAppDomainGet-WebRequestGet-UserPrivileges

Get-UserPrivileges NetworkService

Microsoft TechDayshttp://www.techdays.ru

Ссылки по темеСтраничка ресурсов IIS 7:

http://www.iis.netДокументация по PowerShell IIS Provider

Мои блоги:http://dmitrysotnikov.wordpress.comhttp://www.itcommunity.ru/blogs/dmitrysotnikov

Другие русские блоги по PowerShell:http://xaegr.wordpress.com/http://www.sysadmins.lv/ http://blogs.technet.com/abeshkov/

Инструментарий:http://powergui.org

Microsoft TechDayshttp://www.techdays.ru

© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.