PowerShell ile yapılabilecekler 2

1
253

Selamlar arkadaşlar,

Bir önceki anlatımımızda PowerShell’de yönetici olarak yazmış olduğumuz kodları çalıştırma, klasör oluşturma, klasör dizinine gitme, dosya silme ve dosya indirme işleminden bahsetmiştim buradan ulaşabilirsiniz.

Bugün Windows Server’larda bulunan ve paket olarak gelen IIS(Internet Information Services)’in PowerShell komutu ile kurmayı anlatacağım. Bu komut Win 7/8/10/11 de çalışmaktadır.

Yönetici olarak çalıştırma kodu:
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] “Administrator”)) { Start-Process powershell.exe “-NoProfile -ExecutionPolicy Bypass -File `”$PSCommandPath`”” -Verb RunAs; exit }

Server işletim sisteminde çalışmaktadır ve ServerManager’i import etmektedir:
Import-Module ServerManager

Açılması gerek özellikleri ekleyebilirsiniz:
Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -like “IIS*”} | Format-Table

Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHTTPFeatures -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-DefaultDocument -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-DirectoryBrowsing -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-StaticContent -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HTTPLogging -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpCompressionStatic -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestFiltering -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45 -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationInit -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIExtensions -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIFilter -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementConsole -All
Enable-WindowsOptionalFeature -Online -FeatureName NetFx4Extended-ASPNET45 -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45 -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementService -All

Tüm kodları PowerShell üzerine yapıştırıp, PowerShell ISE ve ya .ps1 dosyasına ekleyerek Run PowerShell diyerek çalıştırabiliriz

if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] “Administrator”)) { Start-Process powershell.exe “-NoProfile -ExecutionPolicy Bypass -File `”$PSCommandPath`”” -Verb RunAs; exit }
Import-Module ServerManager
Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -like “IIS*”} | Format-Table

Enable-WindowsOptionalFeature -Online -FeatureName IIS-CommonHTTPFeatures -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-DefaultDocument -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-DirectoryBrowsing -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-StaticContent -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HTTPLogging -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-HttpCompressionStatic -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-RequestFiltering -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-NetFxExtensibility45 -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationInit -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIExtensions -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ISAPIFilter -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementConsole -All
Enable-WindowsOptionalFeature -Online -FeatureName NetFx4Extended-ASPNET45 -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ASPNET45 -All
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementService -All

0 0 votes
Article Rating
Subscribe
Bildir
guest
1 Yorum
En yeniler
Eskiler Beğenilenler
Inline Feedbacks
View all comments
trackback

[…] olarak gelen IIS(Internet Information Services)’in PowerShell komutu ile kurmayı anlatmıştım buradan […]