PowerShell ile yapılabilecekler 4

0
271

Selamlar arkadaşlar,

Bir önceki anlatımımızda PowerShell dosya kopyalama ve sıkıştırıp zip dosyası yapmayı anlatmıştım buradan ulaşabilirsiniz.

Bugün sizlere PowerShell komutu ile IIS’e WebSite ve AppPool eklemeyi anlatacağım. Bildiğiniz üzere IIS Windows Server’larda Web uygulamalarını çalıştırmamızı sağlayan bir özellik veya programdır. Ayrıca WebSite ve uygulama havuzuna uygulamayı elle de ekleyebiliriz. PowerShell Komutu başka bir sunucuya geçtik diyelim hızlıca PowerShell komutları ile kurabiliriz.

İlk olarak Yönetici olarak çalıştırmak için Komutların başına yönetici olarak çalıştırma komutu ekliyoruz.

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 }

WebAdministration modülünü import ediyoruz.

"$PSCommandPath“” -Verb RunAs; exit }

Import-Module WebAdministration

Install-Module -Name IISAdministration

IISAdministration modülünü import ediyoruz veya yüklüyoruz.

IIS Sites dizinine gidiyoruz.

cd IIS:

cd IIS:\Sites\

“deneme” adında web sitesi oluşturuyoruz.

New-IISSite -Name “deneme” -BindingInformation “*:222:” -PhysicalPath “C:\inetpub\deneme”

deneme AppPool’una gidiyoruz ve managedRuntimeVersion’u v4.0 yapıyoruz.

New-Item -Path IIS:\AppPools\deneme

Get-ItemProperty IIS:\AppPools\deneme | select *

Set-ItemProperty -Path IIS:\AppPools\deneme -Name managedRuntimeVersion -Value ‘v4.0’

32 ve 64 bit çalıştırma özelliğini aktif ediyoruz.

Set-ItemProperty -Path IIS:\AppPools\deneme -Name “enable32BitAppOnWin64” -Value “true”

AppPool oluşturuyoruz.

Get-ChildItem -Path IIS:\AppPools

Set-ItemProperty IIS:\Sites\deneme -name ApplicationPool -value deneme

Sunucuyu Resetliyoruz.

net stop w3svc
net start w3svc

PowerShell komutunu aşağıdaki düzende çalıştırabilirsiniz. Ayrıca ps1 dosyası yaparak çalıştırabilirsiniz.

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 WebAdministration

Install-Module -Name IISAdministration

cd IIS:

cd IIS:\Sites\

New-IISSite -Name “deneme” -BindingInformation “*:222:” -PhysicalPath “C:\inetpub\deneme”

Start-Sleep -Seconds 3

cd C:\

New-Item -Path IIS:\AppPools\deneme

Get-ItemProperty IIS:\AppPools\deneme | select *

Set-ItemProperty -Path IIS:\AppPools\deneme -Name managedRuntimeVersion -Value ‘v4.0’

Set-ItemProperty -Path IIS:\AppPools\deneme -Name “enable32BitAppOnWin64” -Value “true”

Get-ChildItem -Path IIS:\AppPools

Set-ItemProperty IIS:\Sites\deneme -name ApplicationPool -value deneme
net stop w3svc
net start w3svc

0 0 votes
Article Rating
Subscribe
Bildir
guest
0 Yorum
Inline Feedbacks
View all comments