<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>redux-framework</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>di-blocks</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>insert-headers-and-footers</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<br />
<b>Notice</b>:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>voice</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in <b>/home/ahmetozg/blog/wp-includes/functions.php</b> on line <b>6131</b><br />
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PowerShell &#8211; Ahmet Özgün Özcan</title>
	<atom:link href="https://blog.ahmetozgunozcan.com.tr/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.ahmetozgunozcan.com.tr</link>
	<description>Ahmet Özgün Özcan Blog</description>
	<lastBuildDate>Fri, 03 Dec 2021 21:27:56 +0000</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.2</generator>
	<item>
		<title>PowerShell İle IIS Export ve Import</title>
		<link>https://blog.ahmetozgunozcan.com.tr/powershell-ile-iis-export-ve-import/</link>
					<comments>https://blog.ahmetozgunozcan.com.tr/powershell-ile-iis-export-ve-import/#respond</comments>
		
		<dc:creator><![CDATA[Ahmet Özgün ÖZCAN]]></dc:creator>
		<pubDate>Tue, 10 Dec 2019 20:24:48 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[powershell]]></category>
		<guid isPermaLink="false">https://blog.ahmetozgunozcan.com.tr/?p=1559</guid>

					<description><![CDATA[PowerShell komutları kullanarak IIS içerisindeki site tanımlarını başka bir IIS’te tanımlayabiliriz. Keşke Ctrl+C ve Ctrl+P tuş kombinasyonları ile yapabilseydik. 😃&#160; Her IIS için tüm tanımlamaları ve ayarları tekrar aynı şekilde hiç bir işlemi atlamadan manuel yapmak oldukça zaman alır. Risklidir. Ayrıca bu durum size zaman kaybettireceği gibi iş açısından da sizi zarara sokabilir. Yapacağınız küçük [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>PowerShell komutları kullanarak IIS içerisindeki site tanımlarını başka bir IIS’te tanımlayabiliriz. Keşke Ctrl+C ve Ctrl+P tuş kombinasyonları ile yapabilseydik. 😃&nbsp;</p>



<p>Her IIS için tüm tanımlamaları ve ayarları tekrar aynı şekilde hiç bir işlemi atlamadan manuel yapmak oldukça zaman alır. Risklidir. Ayrıca bu durum size zaman kaybettireceği gibi iş açısından da sizi zarara sokabilir. Yapacağınız küçük bir hata veya unuttuğunuz herhangi bir detay işinizin yanlış ve hatalı olmasına neden olabilir. Aynı sistem farklı makinelerde farklı çalışır veya hiç çalışmaz.&nbsp;</p>



<p>Burada gösterilen Export &amp; İmport işlemleri Copy-Paste kadar kolay olmasa da manuel yönteme göre daha basittir. Ayrıca her IIS birbirinin tıpatıp aynısı olacaktır.</p>



<hr class="wp-block-separator"/>



<h4 class="wp-block-heading"><strong>Şimdi yapacağımız örnek kopyalama yöntemi ile hem daha çabuk hem de doğru bir kurulum işlemi gerçekleşecek.</strong></h4>



<p>Taşıyacağımız IIS resimlede görüldüğü gibidir. Bir kaç özel ayarları vardır. Mesela;</p>



<ul><li>OrnekSite’nin 8080 portu ile bind edilmesi,</li><li>OrnekSite Application Pool için resimde görüldüğü üzere özel ayarların bulunması. ( Recyling, Rapid Fail Protection, Identity, Idle Time-out)</li></ul>



<figure class="wp-block-image is-style-default"><img decoding="async" src="https://cdn-images-1.medium.com/max/800/0*z84jshdyPl3TLZGQ.jpg" alt=""/><figcaption>Sites</figcaption></figure>



<figure class="wp-block-image is-style-default"><img decoding="async" src="https://cdn-images-1.medium.com/max/800/0*ZRse6QRxcKg43Avz.jpg" alt=""/><figcaption>Applicatiın Pools</figcaption></figure>



<figure class="wp-block-image is-style-default"><img decoding="async" src="https://cdn-images-1.medium.com/max/800/1*DpzjVvDJWGG0jlMrmKPgQA.jpeg" alt=""/><figcaption>App Poo lProperties</figcaption></figure>



<hr class="wp-block-separator"/>



<p>Öncelikle Windows PowerShell veya Windows PowerShell ISE uygulamasından birini açalım.</p>



<h4 class="wp-block-heading">Site Export&nbsp;İşlemi</h4>



<p>Export işlemini gerçekleştirecek kod parçacığı aşağıdadır. Bu kod ile C dizininde site.xml adında bir dosya oluşturulur.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="powershell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$appcmd = $Env:WinDir+'\system32\inetsrv\appcmd.exe'
&amp; $appcmd list site /config /xml > c:\site.xml</pre>



<p><strong>Site.XML İçeriği</strong></p>



<p></p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;appcmd>
    &lt;SITE SITE.NAME="Default Web Site" SITE.ID="1" bindings="http/*:80:,net.tcp/808:*,net.msmq/localhost,msmq.formatname/localhost,net.pipe/*" state="Started">
        &lt;site name="Default Web Site" id="1">
            &lt;bindings>
                &lt;binding protocol="http" bindingInformation="*:80:" />
                &lt;binding protocol="net.tcp" bindingInformation="808:*" />
                &lt;binding protocol="net.msmq" bindingInformation="localhost" />
                &lt;binding protocol="msmq.formatname" bindingInformation="localhost" />
                &lt;binding protocol="net.pipe" bindingInformation="*" />
            &lt;/bindings>
            &lt;limits />
            &lt;logFile>
                &lt;customFields>
                &lt;/customFields>
            &lt;/logFile>
            &lt;traceFailedRequestsLogging />
            &lt;hsts />
            &lt;applicationDefaults />
            &lt;virtualDirectoryDefaults />
            &lt;ftpServer>
                &lt;connections />
                &lt;security>
                    &lt;dataChannelSecurity />
                    &lt;commandFiltering>
                    &lt;/commandFiltering>
                    &lt;ssl />
                    &lt;sslClientCertificates />
                    &lt;authentication>
                        &lt;anonymousAuthentication />
                        &lt;basicAuthentication />
                        &lt;clientCertAuthentication />
                        &lt;customAuthentication>
                            &lt;providers>
                            &lt;/providers>
                        &lt;/customAuthentication>
                    &lt;/authentication>
                    &lt;customAuthorization>
                        &lt;provider />
                    &lt;/customAuthorization>
                &lt;/security>
                &lt;customFeatures>
                    &lt;providers>
                    &lt;/providers>
                &lt;/customFeatures>
                &lt;messages />
                &lt;fileHandling />
                &lt;firewallSupport />
                &lt;userIsolation>
                    &lt;activeDirectory />
                &lt;/userIsolation>
                &lt;directoryBrowse />
                &lt;logFile />
            &lt;/ftpServer>
            &lt;application path="/">
                &lt;virtualDirectoryDefaults />
                &lt;virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot" />
            &lt;/application>
        &lt;/site>
    &lt;/SITE>
    &lt;SITE SITE.NAME="OrnekSite" SITE.ID="2" bindings="http/*:8080:test" state="Started">
        &lt;site name="OrnekSite" id="2">
            &lt;bindings>
                &lt;binding protocol="http" bindingInformation="*:8080:test" />
            &lt;/bindings>
            &lt;limits />
            &lt;logFile>
                &lt;customFields>
                &lt;/customFields>
            &lt;/logFile>
            &lt;traceFailedRequestsLogging />
            &lt;hsts />
            &lt;applicationDefaults />
            &lt;virtualDirectoryDefaults />
            &lt;ftpServer>
                &lt;connections />
                &lt;security>
                    &lt;dataChannelSecurity />
                    &lt;commandFiltering>
                    &lt;/commandFiltering>
                    &lt;ssl />
                    &lt;sslClientCertificates />
                    &lt;authentication>
                        &lt;anonymousAuthentication />
                        &lt;basicAuthentication />
                        &lt;clientCertAuthentication />
                        &lt;customAuthentication>
                            &lt;providers>
                            &lt;/providers>
                        &lt;/customAuthentication>
                    &lt;/authentication>
                    &lt;customAuthorization>
                        &lt;provider />
                    &lt;/customAuthorization>
                &lt;/security>
                &lt;customFeatures>
                    &lt;providers>
                    &lt;/providers>
                &lt;/customFeatures>
                &lt;messages />
                &lt;fileHandling />
                &lt;firewallSupport />
                &lt;userIsolation>
                    &lt;activeDirectory />
                &lt;/userIsolation>
                &lt;directoryBrowse />
                &lt;logFile />
            &lt;/ftpServer>
            &lt;application path="/" applicationPool="OrnekSite">
                &lt;virtualDirectoryDefaults />
                &lt;virtualDirectory path="/" physicalPath="C:\" />
            &lt;/application>
        &lt;/site>
    &lt;/SITE>
  &lt;/appcmd></pre>



<h4 class="wp-block-heading">Application Pool Export&nbsp;İşlemi</h4>



<p>Export işlemini gerçekleştirecek kod aşağıdadır. Bu kod ile C dizininde pool.xml adında bir dosya oluşturulur.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="powershell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$appcmd = $Env:WinDir+'\system32\inetsrv\appcmd.exe'
&amp; $appcmd list site /config /xml > c:\site.xml</pre>



<p><strong>Pool.XML İçeriği</strong></p>



<p></p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;appcmd>
    &lt;APPPOOL APPPOOL.NAME="DefaultAppPool" PipelineMode="Integrated" RuntimeVersion="v4.0" state="Started">
        &lt;add name="DefaultAppPool">
            &lt;processModel />
            &lt;recycling>
                &lt;periodicRestart>
                    &lt;schedule>
                    &lt;/schedule>
                &lt;/periodicRestart>
            &lt;/recycling>
            &lt;failure />
            &lt;cpu />
            &lt;environmentVariables>
            &lt;/environmentVariables>
        &lt;/add>
    &lt;/APPPOOL>
    &lt;APPPOOL APPPOOL.NAME="Classic .NET AppPool" PipelineMode="Classic" RuntimeVersion="v2.0" state="Started">
        &lt;add name="Classic .NET AppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic">
            &lt;processModel />
            &lt;recycling>
                &lt;periodicRestart>
                    &lt;schedule>
                    &lt;/schedule>
                &lt;/periodicRestart>
            &lt;/recycling>
            &lt;failure />
            &lt;cpu />
            &lt;environmentVariables>
            &lt;/environmentVariables>
        &lt;/add>
    &lt;/APPPOOL>
    &lt;APPPOOL APPPOOL.NAME=".NET v2.0 Classic" PipelineMode="Classic" RuntimeVersion="v2.0" state="Started">
        &lt;add name=".NET v2.0 Classic" managedRuntimeVersion="v2.0" managedPipelineMode="Classic">
            &lt;processModel />
            &lt;recycling>
                &lt;periodicRestart>
                    &lt;schedule>
                    &lt;/schedule>
                &lt;/periodicRestart>
            &lt;/recycling>
            &lt;failure />
            &lt;cpu />
            &lt;environmentVariables>
            &lt;/environmentVariables>
        &lt;/add>
    &lt;/APPPOOL>
    &lt;APPPOOL APPPOOL.NAME=".NET v2.0" PipelineMode="Integrated" RuntimeVersion="v2.0" state="Started">
        &lt;add name=".NET v2.0" managedRuntimeVersion="v2.0">
            &lt;processModel />
            &lt;recycling>
                &lt;periodicRestart>
                    &lt;schedule>
                    &lt;/schedule>
                &lt;/periodicRestart>
            &lt;/recycling>
            &lt;failure />
            &lt;cpu />
            &lt;environmentVariables>
            &lt;/environmentVariables>
        &lt;/add>
    &lt;/APPPOOL>
    &lt;APPPOOL APPPOOL.NAME=".NET v4.5 Classic" PipelineMode="Classic" RuntimeVersion="v4.0" state="Started">
        &lt;add name=".NET v4.5 Classic" managedRuntimeVersion="v4.0" managedPipelineMode="Classic">
            &lt;processModel />
            &lt;recycling>
                &lt;periodicRestart>
                    &lt;schedule>
                    &lt;/schedule>
                &lt;/periodicRestart>
            &lt;/recycling>
            &lt;failure />
            &lt;cpu />
            &lt;environmentVariables>
            &lt;/environmentVariables>
        &lt;/add>
    &lt;/APPPOOL>
    &lt;APPPOOL APPPOOL.NAME=".NET v4.5" PipelineMode="Integrated" RuntimeVersion="v4.0" state="Started">
        &lt;add name=".NET v4.5" managedRuntimeVersion="v4.0">
            &lt;processModel />
            &lt;recycling>
                &lt;periodicRestart>
                    &lt;schedule>
                    &lt;/schedule>
                &lt;/periodicRestart>
            &lt;/recycling>
            &lt;failure />
            &lt;cpu />
            &lt;environmentVariables>
            &lt;/environmentVariables>
        &lt;/add>
    &lt;/APPPOOL>
    &lt;APPPOOL APPPOOL.NAME="OrnekSite" PipelineMode="Classic" RuntimeVersion="v4.0" state="Started">
        &lt;add name="OrnekSite" managedRuntimeVersion="v4.0" managedPipelineMode="Classic">
            &lt;processModel identityType="SpecificUser" userName="DOMAIN\serviceuser" password="" />
            &lt;recycling>
                &lt;periodicRestart time="00:00:00">
                    &lt;schedule>
                    &lt;/schedule>
                &lt;/periodicRestart>
            &lt;/recycling>
            &lt;failure rapidFailProtection="false" />
            &lt;cpu />
            &lt;environmentVariables>
            &lt;/environmentVariables>
        &lt;/add>
    &lt;/APPPOOL>
&lt;/appcmd></pre>



<p><strong>Site &amp; Pool Import</strong></p>



<p>site.xml ve pool.xml dosyalarımızda tüm IIS ayarlarımız bulunmaktadır. Şimdi istediğimiz makinede import işlemini gerçekleştirebiliriz. Aşağıdaki kod önce Application Pool tanımlamalarını sonra site tanımlamalarını oluşturacak şekilde hazırlanmıştır.</p>



<p></p>



<pre class="EnlighterJSRAW" data-enlighter-language="powershell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$appcmd = $Env:WinDir+'\system32\inetsrv\appcmd.exe'

get-content "c:\pool.xml" | &amp; $appcmd add apppool /in

get-content "c:\site.xml" | &amp; $appcmd add site /in</pre>



<p><strong>PoPowerShell Result:</strong></p>


<p>APPPOOL object “DefaultAppPool” added<br />APPPOOL object “Classic .NET AppPool” added<br />APPPOOL object “.NET v2.0 Classic” added<br />APPPOOL object “.NET v2.0” added<br />APPPOOL object “.NET v4.5 Classic” added<br />APPPOOL object “.NET v4.5” added<br />APPPOOL object “OrnekSite” added<br />SITE object “Default Web Site” added<br />SITE object “OrnekSite” added</p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.ahmetozgunozcan.com.tr/powershell-ile-iis-export-ve-import/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
