<?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>Yusuf Ozturk &#187; Windows Powershell</title>
	<atom:link href="http://www.yusufozturk.info/category/windows-powershell/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yusufozturk.info</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 16 Jul 2010 10:09:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Renaming all file names in a directory with Powershell</title>
		<link>http://www.yusufozturk.info/windows-powershell/renaming-all-file-names-in-a-directory-with-powershell.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=renaming-all-file-names-in-a-directory-with-powershell</link>
		<comments>http://www.yusufozturk.info/windows-powershell/renaming-all-file-names-in-a-directory-with-powershell.html#comments</comments>
		<pubDate>Sun, 27 Jun 2010 18:46:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[changing file name powershell]]></category>
		<category><![CDATA[rename file powershell]]></category>
		<category><![CDATA[rename-item powershell]]></category>
		<category><![CDATA[replacing file names powershell]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=2061</guid>
		<description><![CDATA[If you use Flashget, sometimes it downloads files with .html extension. You have to trim .html extensions from files but if you download so many files, you need to use script to save your time. $files = dir foreach &#40;$file in $files&#41; &#123; $new=$file.name.replace&#40;&#34;.html&#34;,&#34;&#34;&#41; ren $file $new &#125; Simply, I use basic dos command, ren [...]]]></description>
			<content:encoded><![CDATA[<p>If you use Flashget, sometimes it downloads files with .html extension. You have to trim .html extensions from files but if you download so many files, you need to use script to save your time.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$files</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">dir</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$file</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$files</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$new</span><span style="color: pink;">=</span><span style="color: #800080;">$file</span>.name.replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;.html&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #008080; font-weight: bold;">ren</span> <span style="color: #800080;">$file</span> <span style="color: #800080;">$new</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Simply, I use basic dos command, ren to rename files. But you can use Rename-Item to make it 100% Powershell :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/windows-powershell/renaming-all-file-names-in-a-directory-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Dell servers hardware specification with Powershell</title>
		<link>http://www.yusufozturk.info/windows-powershell/getting-dell-servers-hardware-specification-with-powershell.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=getting-dell-servers-hardware-specification-with-powershell</link>
		<comments>http://www.yusufozturk.info/windows-powershell/getting-dell-servers-hardware-specification-with-powershell.html#comments</comments>
		<pubDate>Thu, 17 Jun 2010 09:32:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[dell r210 powershell]]></category>
		<category><![CDATA[dell server powershell]]></category>
		<category><![CDATA[dell service tag automation]]></category>
		<category><![CDATA[dell service tags powershell]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=2057</guid>
		<description><![CDATA[One of my colleague asked me to make a script to write out server specifications of our new Dell servers using with their Service Tags. Recently, We rented more than 200 Dell servers and that is real mess to know which one has 4 gb ram and which one has SAS raid etc. The quickiest [...]]]></description>
			<content:encoded><![CDATA[<p>One of my colleague asked me to make a script to write out server specifications of our new Dell servers using with their Service Tags. Recently, We rented more than 200 Dell servers and that is real mess to know which one has 4 gb ram and which one has SAS raid etc. The quickiest way to know this, using their Service Tags. Because you can see servers hardware from Dell web page with Service Tags. My script simply use service tags to get hardware and parse it for a more readable format.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$ServiceTags</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-Content</span> C:\ServiceTags.txt
<span style="color: #800080;">$TagsDir</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;C:\ServiceTags&quot;</span>
<span style="color: #0000FF;">Foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$ServiceTag</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$ServiceTags</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$SystemInfoURL</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;http://support.dell.com/support/topics/global.aspx/support/my_systems_info/en/details?c=us&amp;l=en&amp;s=gen&amp;servicetag=&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ServiceTag</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;&amp;~tab=2&amp;~wsf=tabs&quot;</span>
<span style="color: #800080;">$Webclient</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Net.WebClient
<span style="color: #800080;">$Webpage</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Webclient</span>.DownloadString<span style="color: #000000;">&#40;</span><span style="color: #800080;">$SystemInfoURL</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$Webpage</span> <span style="color: pink;">&gt;</span> <span style="color: #800000;">&quot;$TagsDir\$ServiceTag.txt&quot;</span>
&nbsp;
<span style="color: #800080;">$HardDrive</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Select-String</span> <span style="color: #800000;">&quot;$TagsDir\$ServiceTag.txt&quot;</span> <span style="color: #008080; font-style: italic;">-Pattern</span> <span style="color: #800000;">'Hard Drive'</span>
<span style="color: #800080;">$HardDrive</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;$HardDrive&quot;</span> <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;([^&quot;]+)&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;Hard Drive,(.*?),([^&quot;]+)&lt;/td&gt;'</span>
<span style="color: #800080;">$HardDriveModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">6</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$HardDriveModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$HardDriveModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;  &quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$HardDriveModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$HardDriveModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$HardDriveCount</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$HardDriveSize</span>  <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span>
&nbsp;
<span style="color: #800080;">$Processor</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Select-String</span> <span style="color: #800000;">&quot;$TagsDir\$ServiceTag.txt&quot;</span> <span style="color: #008080; font-style: italic;">-Pattern</span> <span style="color: #800000;">'Processor'</span>
<span style="color: #800080;">$Processor</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;$Processor&quot;</span> <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;([^&quot;]+)&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;Processor,(.*?),([^&quot;]+)&lt;/td&gt;'</span>
<span style="color: #800080;">$ProcessorModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">6</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$ProcessorModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ProcessorModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;  &quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$ProcessorModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ProcessorModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$ProcessorCount</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$ProcessorSize</span>  <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span>
&nbsp;
<span style="color: #800080;">$Memory</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Select-String</span> <span style="color: #800000;">&quot;$TagsDir\$ServiceTag.txt&quot;</span> <span style="color: #008080; font-style: italic;">-Pattern</span> <span style="color: #800000;">'Memory'</span>
<span style="color: #800080;">$Memory</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;$Memory&quot;</span> <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;([^&quot;]+)&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;Dual In-line Memory Module,(.*?),([^&quot;]+)&lt;/td&gt;'</span>
<span style="color: #800080;">$MemoryModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">6</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$MemoryModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$MemoryModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;  &quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$MemoryModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$MemoryModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$MemoryCount</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$MemorySize</span>  <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span>
&nbsp;
<span style="color: #800080;">$Raid</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Select-String</span> <span style="color: #800000;">&quot;$TagsDir\$ServiceTag.txt&quot;</span> <span style="color: #008080; font-style: italic;">-Pattern</span> <span style="color: #800000;">'Assembly'</span>
<span style="color: #800080;">$Raid</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;$Raid&quot;</span> <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;([^&quot;]+)&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;&lt;/td&gt;&lt;td class=&quot;([^&quot;]+)&quot; valign=&quot;top&quot;&gt;Assembly,Cable,(.*?),([^&quot;]+)&lt;/td&gt;'</span>
<span style="color: #800080;">$RaidModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$RaidModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$RaidModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;  &quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$RaidModel</span> <span style="color: pink;">=</span> <span style="color: #800080;">$RaidModel</span>.Replace<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$RaidCount</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span>
<span style="color: #800080;">$RaidType</span>  <span style="color: pink;">=</span> <span style="color: #800080;">$Matches</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">6</span><span style="color: #000000;">&#93;</span>
&nbsp;
<span style="color: #008080; font-weight: bold;">Write-Host</span> Service Tag: <span style="color: #800080;">$ServiceTag</span> <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Red
<span style="color: #008080; font-weight: bold;">Write-Host</span> Hard Drive: <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Green
<span style="color: #008080; font-weight: bold;">write-host</span> Adet: <span style="color: #800080;">$HardDriveCount</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Kapasite: <span style="color: #800080;">$HardDriveSize</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Model: <span style="color: #800080;">$HardDriveModel</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> Processor: <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Green
<span style="color: #008080; font-weight: bold;">write-host</span> Adet: <span style="color: #800080;">$ProcessorCount</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Kapasite: <span style="color: #800080;">$ProcessorSize</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Model: <span style="color: #800080;">$ProcessorModel</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> Memory: <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Green
<span style="color: #008080; font-weight: bold;">write-host</span> Adet: <span style="color: #800080;">$MemoryCount</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Kapasite: <span style="color: #800080;">$MemorySize</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Model: <span style="color: #800080;">$MemoryModel</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> Raid: <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Green
<span style="color: #008080; font-weight: bold;">write-host</span> Adet: <span style="color: #800080;">$RaidCount</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Tip: <span style="color: #800080;">$RaidType</span>
<span style="color: #008080; font-weight: bold;">write-host</span> Model: <span style="color: #800080;">$RaidModel</span>
<span style="color: #008080; font-weight: bold;">write-host</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>You can use Add-Content to print them to txt files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/windows-powershell/getting-dell-servers-hardware-specification-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Exchange Server 2010&#8242;dan default mailbox&#8217;ı kaldırmak</title>
		<link>http://www.yusufozturk.info/exchange-server/exchange-server-2010dan-default-mailboxi-kaldirmak.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=exchange-server-2010dan-default-mailboxi-kaldirmak</link>
		<comments>http://www.yusufozturk.info/exchange-server/exchange-server-2010dan-default-mailboxi-kaldirmak.html#comments</comments>
		<pubDate>Wed, 05 May 2010 16:59:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Exchange Server]]></category>
		<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[exchange 2010 default database silme]]></category>
		<category><![CDATA[exchange 2010 remove default database]]></category>
		<category><![CDATA[exchange 2010 remove default mailbox]]></category>
		<category><![CDATA[remove default mailbox]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=2016</guid>
		<description><![CDATA[Exchange Server 2010 kurulumu sonrası gelen default mailbox&#8217;ı, içinde sistem mailbox&#8217;ı barındırdığı için EMC üzerinden Remove edemezsiniz. Bunun için Powershell üzerinden aşağıdaki adımları uygulamanız gerekiyor. Öncelikle gizli sistem mailbox&#8217;larını görüntüleyelim: Get-Mailbox -Arbitration Sonra aşağıdaki komut ile bu mailbox&#8217;ları yeni database&#8217;e taşıyalım: Get-Mailbox -Arbitration &#124; New-MoveRequest -TargetDatabase “Yeni_Database” Yukardaki komut sonrası bu mailbox&#8217;lar taşınmaya başlarlar. Taşınma [...]]]></description>
			<content:encoded><![CDATA[<p>Exchange Server 2010 kurulumu sonrası gelen default mailbox&#8217;ı, içinde sistem mailbox&#8217;ı barındırdığı için EMC üzerinden Remove edemezsiniz. Bunun için Powershell üzerinden aşağıdaki adımları uygulamanız gerekiyor.</p>
<p>Öncelikle gizli sistem mailbox&#8217;larını görüntüleyelim:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>Mailbox <span style="color: pink;">-</span>Arbitration</pre></div></div>

<p>Sonra aşağıdaki komut ile bu mailbox&#8217;ları yeni database&#8217;e taşıyalım:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>Mailbox <span style="color: pink;">-</span>Arbitration <span style="color: pink;">|</span> New<span style="color: pink;">-</span>MoveRequest <span style="color: pink;">-</span>TargetDatabase “Yeni_Database”</pre></div></div>

<p>Yukardaki komut sonrası bu mailbox&#8217;lar taşınmaya başlarlar. Taşınma durumunu aşağıdaki komut ile görebilirsiniz.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>MoveRequest</pre></div></div>

<p>Eğer mailbox&#8217;ların taşınma işlemi için completed deniliyorsa, aşağıdaki komut ile bu mailbox&#8217;ların MoveRequest&#8217;lerini kaldırabilirsiniz.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>MoveRequest <span style="color: pink;">|</span> Remove<span style="color: pink;">-</span>MoveRequest</pre></div></div>

<p>Bu işlemler sonrasında artık EMC üzerinden eski database&#8217;i kaldırmanız mümkün durumdadır.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/exchange-server/exchange-server-2010dan-default-mailboxi-kaldirmak.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange Server 2010 için örnek CSR başvurusu</title>
		<link>http://www.yusufozturk.info/exchange-server/exchange-server-2010-icin-ornek-csr-basvurusu.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=exchange-server-2010-icin-ornek-csr-basvurusu</link>
		<comments>http://www.yusufozturk.info/exchange-server/exchange-server-2010-icin-ornek-csr-basvurusu.html#comments</comments>
		<pubDate>Tue, 04 May 2010 21:00:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Exchange Server]]></category>
		<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[exchange 2010]]></category>
		<category><![CDATA[exchange csr]]></category>
		<category><![CDATA[exchange powershell cert request]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=2011</guid>
		<description><![CDATA[Yapınızda birden fazla Exchange Server 2010 var ise aşağıdaki gibi csr başvurusu yapabilir ve aynı SSL&#8217;i birden fazla sunucu üzerinde tutabilirsiniz. New-ExchangeCertificate -FriendlyName 'exchange.radore.net' -GenerateRequest -PrivateKeyExportable $true -KeySize '2048' -SubjectName 'C=TR,S=&#34;Metrocity&#34;,L=&#34;Istanbul&#34;,O=&#34;Radore Hosting&#34;,OU=&#34;IT&#34;,CN=exchange.radore.net' -DomainName 'exchange.radore.net','autodiscover.rh.com.tr','autodiscover.rh.net.tr','EXCAS','MAILBOX','EXC2010' -Server 'EXCAS' Sertifikanın complete işlemini Exchange arabirimi üzerinden yapabilirsiniz.]]></description>
			<content:encoded><![CDATA[<p>Yapınızda birden fazla Exchange Server 2010 var ise aşağıdaki gibi csr başvurusu yapabilir ve aynı SSL&#8217;i birden fazla sunucu üzerinde tutabilirsiniz.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">New<span style="color: pink;">-</span>ExchangeCertificate <span style="color: pink;">-</span>FriendlyName <span style="color: #800000;">'exchange.radore.net'</span> <span style="color: pink;">-</span>GenerateRequest <span style="color: pink;">-</span>PrivateKeyExportable <span style="color: #800080;">$true</span> <span style="color: pink;">-</span>KeySize <span style="color: #800000;">'2048'</span> <span style="color: pink;">-</span>SubjectName <span style="color: #800000;">'C=TR,S=&quot;Metrocity&quot;,L=&quot;Istanbul&quot;,O=&quot;Radore Hosting&quot;,OU=&quot;IT&quot;,CN=exchange.radore.net'</span> <span style="color: pink;">-</span>DomainName <span style="color: #800000;">'exchange.radore.net'</span><span style="color: pink;">,</span><span style="color: #800000;">'autodiscover.rh.com.tr'</span><span style="color: pink;">,</span><span style="color: #800000;">'autodiscover.rh.net.tr'</span><span style="color: pink;">,</span><span style="color: #800000;">'EXCAS'</span><span style="color: pink;">,</span><span style="color: #800000;">'MAILBOX'</span><span style="color: pink;">,</span><span style="color: #800000;">'EXC2010'</span> <span style="color: pink;">-</span>Server <span style="color: #800000;">'EXCAS'</span></pre></div></div>

<p>Sertifikanın complete işlemini Exchange arabirimi üzerinden yapabilirsiniz.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/exchange-server/exchange-server-2010-icin-ornek-csr-basvurusu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange Server 2007&#8242;den Disconnected Mailbox&#8217;ların kaldırılması</title>
		<link>http://www.yusufozturk.info/exchange-server/exchange-server-2007den-disconnected-mailboxlarin-kaldirilmasi.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=exchange-server-2007den-disconnected-mailboxlarin-kaldirilmasi</link>
		<comments>http://www.yusufozturk.info/exchange-server/exchange-server-2007den-disconnected-mailboxlarin-kaldirilmasi.html#comments</comments>
		<pubDate>Tue, 27 Apr 2010 19:05:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Exchange Server]]></category>
		<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[disconnected mailbox silme]]></category>
		<category><![CDATA[exchange 2007 disconnected mailbox kaldırma]]></category>
		<category><![CDATA[exchange 2007 disconnected mailbox powershell]]></category>
		<category><![CDATA[exchange 2007 mailbox silme]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1991</guid>
		<description><![CDATA[Exchange 2007&#8242;den mailbox sildiğinizde, bu mailbox disconnected mailbox&#8217;lar altında görünmeye devam eder. Mailbox&#8217;ın kullanıcısını ise başka bir mailbox ekleyemezsiniz bu durumda. Bu yüzden disconnected mailbox&#8217;ı kaldırmalı ve kullanıcıyı boşa çıkarmalıyız. Bu işlemi de Powershell üzerinden yapabilmekteyiz. Aşağıda Powershell v1 ve v2 kodlarını bulabilirsiniz. Powershell v1: Get-MailboxStatistics &#124; where-object &#123; $_.DisconnectDate -ne $null &#125; &#124; Select [...]]]></description>
			<content:encoded><![CDATA[<p>Exchange 2007&#8242;den mailbox sildiğinizde, bu mailbox disconnected mailbox&#8217;lar altında görünmeye devam eder. Mailbox&#8217;ın kullanıcısını ise başka bir mailbox ekleyemezsiniz bu durumda. Bu yüzden disconnected mailbox&#8217;ı kaldırmalı ve kullanıcıyı boşa çıkarmalıyız. Bu işlemi de Powershell üzerinden yapabilmekteyiz. Aşağıda Powershell v1 ve v2 kodlarını bulabilirsiniz.</p>
<p>Powershell v1:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>MailboxStatistics <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-object</span> <span style="color: #000000;">&#123;</span> <span style="color: #000080;">$_</span>.DisconnectDate <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$null</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> DisplayName<span style="color: pink;">,</span>MailboxGuid</pre></div></div>

<p>Powershell v2:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>MailboxStatistics <span style="color: pink;">-</span>Database <span style="color: #800000;">&quot;DBName&quot;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-object</span> <span style="color: #000000;">&#123;</span> <span style="color: #000080;">$_</span>.DisconnectDate <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$null</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Select</span> DisplayName<span style="color: pink;">,</span>MailboxGuid</pre></div></div>

<p>Yukardan MailboxGuid&#8217;i aldıktan sonra aşağıdaki komut ile silme işlemini gerçekleştirebilirsiniz.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Remove<span style="color: pink;">-</span>Mailbox <span style="color: pink;">-</span>Database <span style="color: pink;">&lt;</span>Database<span style="color: pink;">-</span>Name<span style="color: pink;">&gt;</span> <span style="color: pink;">-</span>StoreMailboxIdentity <span style="color: pink;">&lt;</span>MailboxGuid<span style="color: pink;">&gt;</span> <span style="color: #008080; font-style: italic;">-confirm</span>:$false</pre></div></div>

<p>Bu işlem sonrası kullanıcınıza sıfır bir mailbox bağlayabilirsiniz.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/exchange-server/exchange-server-2007den-disconnected-mailboxlarin-kaldirilmasi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating daily bandwidth usage of websites on IIS7.5 with Powershell</title>
		<link>http://www.yusufozturk.info/iis7/calculating-daily-bandwidth-usage-of-websites-on-iis7-5-with-powershell.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=calculating-daily-bandwidth-usage-of-websites-on-iis7-5-with-powershell</link>
		<comments>http://www.yusufozturk.info/iis7/calculating-daily-bandwidth-usage-of-websites-on-iis7-5-with-powershell.html#comments</comments>
		<pubDate>Sun, 18 Apr 2010 09:05:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting & IIS7]]></category>
		<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[calculate bandwidth powershell]]></category>
		<category><![CDATA[calculate iis7 bandwidth usage]]></category>
		<category><![CDATA[calculate iis7 traffic]]></category>
		<category><![CDATA[iis log parser 2.2]]></category>
		<category><![CDATA[iis log parser bandwidth usage]]></category>
		<category><![CDATA[iis7 daily bandwidth usage]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1985</guid>
		<description><![CDATA[First, you need IIS Log Parser 2.2 to parse log files and calculate daily usage. Then we will get list of websites with Powershell and write bandwidth usages into a file. Download IIS Log Parser v2.2: http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07 Install IIS Log Parser v2.2. I created a new directory in drive D called LogParser and copied 2 [...]]]></description>
			<content:encoded><![CDATA[<p>First, you need IIS Log Parser 2.2 to parse log files and calculate daily usage. Then we will get list of websites with Powershell and write bandwidth usages into a file.</p>
<p>Download IIS Log Parser v2.2:</p>
<div class="blockquote"><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07">http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07</a></div>
<p>Install IIS Log Parser v2.2. I created a new directory in drive D called LogParser and copied 2 files (logparser.dll and logparser.exe) into that directory. Now let&#8217;s see Powershell codes how to use LogParser v2.2 with Powershell.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;">Import<span style="color: pink;">-</span>Module WebAdministration
Websites <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>Website <span style="color: pink;">*</span>
<span style="color: #0000FF;">Foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$Websites</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$Name</span> <span style="color: pink;">=</span> <span style="color: #800080;">$i</span>.Name
<span style="color: #800080;">$ID</span> <span style="color: pink;">=</span> <span style="color: #800080;">$i</span>.ID
<span style="color: #800080;">$PhysicalPath</span> <span style="color: pink;">=</span> <span style="color: #800080;">$i</span>.PhysicalPath
<span style="color: #800080;">$Date</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-Date</span><span style="color: #000000;">&#41;</span>.AddDays<span style="color: #000000;">&#40;</span><span style="color: pink;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span>.ToString<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;yyMMdd&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">+</span> <span style="color: #800000;">'.log'</span>
<span style="color: #800080;">$Bandwidth</span> <span style="color: pink;">=</span> <span style="color: pink;">&amp;</span><span style="color: #800000;">'D:\tools\LogParser\LogParser.exe'</span> <span style="color: #800000;">&quot;Select Div(Sum(sc-bytes),1048576) As Bandwidth From '$PhysicalPath\W3SVC$ID\u_ex$Date'&quot;</span> <span style="color: pink;">-</span>q:ON
<span style="color: #800080;">$Value</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;$Name : $Bandwidth&quot;</span>
<span style="color: #008080; font-weight: bold;">Add-Content</span> <span style="color: #008080; font-style: italic;">-Path</span> Bandwidth.txt <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$Value</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>You see how easy it is? But this is just an example. I don&#8217;t care about Log Path. You should edit path for your own environment. Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/iis7/calculating-daily-bandwidth-usage-of-websites-on-iis7-5-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell Türkiye Kullanıcıları Grubu Facebook Sayfası</title>
		<link>http://www.yusufozturk.info/windows-powershell/powershell-turkiye-kullanicilari-grubu-facebook-sayfasi.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=powershell-turkiye-kullanicilari-grubu-facebook-sayfasi</link>
		<comments>http://www.yusufozturk.info/windows-powershell/powershell-turkiye-kullanicilari-grubu-facebook-sayfasi.html#comments</comments>
		<pubDate>Tue, 13 Apr 2010 18:35:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[powershell tr grubu]]></category>
		<category><![CDATA[powershell türk]]></category>
		<category><![CDATA[powershell türkiye]]></category>
		<category><![CDATA[powershell türkiye kullanıcı grubu]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1979</guid>
		<description><![CDATA[Türkiye&#8217;deki Powershell kullanıcılarını bir araya getirmeyi amaçlıyorum. Böylece beyin fırtınası yaratarak, daha iyi projeler çıkarabiliriz ortaya. Her ne kadar Powershell kullanıcısı şuan için az olsa da (Türkiye&#8217;de), yapacağım seminer ve webinerler ile Powershell kullanımını arttırmaya çalışacağım. Şuan kişisel sitem yusufozturk.info&#8217;da 100&#8242;ün üzerinde Powershell yazısı bulunmakta. Bunların arasında yeni başlayan kullanıcılara hitaben yazılmış yazılar da var, [...]]]></description>
			<content:encoded><![CDATA[<p>Türkiye&#8217;deki Powershell kullanıcılarını bir araya getirmeyi amaçlıyorum. Böylece beyin fırtınası yaratarak, daha iyi projeler çıkarabiliriz ortaya. Her ne kadar Powershell kullanıcısı şuan için az olsa da (Türkiye&#8217;de), yapacağım seminer ve webinerler ile Powershell kullanımını arttırmaya çalışacağım.</p>
<p>Şuan kişisel sitem yusufozturk.info&#8217;da 100&#8242;ün üzerinde Powershell yazısı bulunmakta. Bunların arasında yeni başlayan kullanıcılara hitaben yazılmış yazılar da var, ileri seviye kullanıcılara göre yazılar da.. Umarım bu sene sonunda bu sayıyı 200&#8242;e çıkartabilirim.</p>
<p>Facebook grubuna aşağıdaki bağlantıdan üye olabilirsiniz:</p>
<div class="blockquote"><a href="http://www.facebook.com/group.php?gid=105220719519853">http://www.facebook.com/group.php?gid=105220719519853</a></div>
<p>Bundan sonraki Powershell yazılarını <a href="http://www.write-host.com">http://www.write-host.com</a> üzerinden yayınlamaya çalışacağım.</p>
<p>Tüm sistem uzmanları ve sistem ile uğraşan öğrencileri gruba beklerim.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/windows-powershell/powershell-turkiye-kullanicilari-grubu-facebook-sayfasi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating New FTP User on Active Directory with Powershell</title>
		<link>http://www.yusufozturk.info/windows-server/creating-new-ftp-user-on-active-directory-with-powershell.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=creating-new-ftp-user-on-active-directory-with-powershell</link>
		<comments>http://www.yusufozturk.info/windows-server/creating-new-ftp-user-on-active-directory-with-powershell.html#comments</comments>
		<pubDate>Tue, 02 Mar 2010 09:43:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting & IIS7]]></category>
		<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[create domain user powershell]]></category>
		<category><![CDATA[create ftp user powershell]]></category>
		<category><![CDATA[ftp user on active directory powershell]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1977</guid>
		<description><![CDATA[Creates a new user on Active Directory and sets &#8220;Password never expires&#8221; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Function Add-FTPUser &#123; Param &#40;$FTPUsername, $FTPPassword&#41; &#160; $ADDomain = &#91;System.DirectoryServices.ActiveDirectory.Domain&#93;::GetCurrentDomain&#40;&#41; $ADDomainName = $ADDomain.Name $ADServer = &#40;$ADDomain.InfrastructureRoleOwner.Name.Split&#40;&#34;.&#34;&#41;&#91;0&#93;&#41; $FQDN = [...]]]></description>
			<content:encoded><![CDATA[<p>Creates a new user on Active Directory and sets &#8220;Password never expires&#8221;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">Function</span> Add<span style="color: pink;">-</span>FTPUser
<span style="color: #000000;">&#123;</span>
<span style="color: #0000FF;">Param</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$FTPUsername</span><span style="color: pink;">,</span> <span style="color: #800080;">$FTPPassword</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #800080;">$ADDomain</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.DirectoryServices.ActiveDirectory.Domain<span style="color: #000000;">&#93;</span>::GetCurrentDomain<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$ADDomainName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ADDomain</span>.Name
    <span style="color: #800080;">$ADServer</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$ADDomain</span>.InfrastructureRoleOwner.Name.Split<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$FQDN</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;DC=&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ADDomain</span>.Name <span style="color: #FF0000;">-Replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;\.&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;,DC=&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$ADDomain</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span> <span style="color: #800000;">&quot;LDAP://$ADServer/$FQDN&quot;</span>
    <span style="color: #800080;">$CustomerOU</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span> <span style="color: #800000;">&quot;LDAP://$CustomerOU,$FQDN&quot;</span>
    <span style="color: #800080;">$User</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span> <span style="color: #800000;">&quot;LDAP://CN=$FTPUsername,$CustomerOU,$FQDN&quot;</span>
    <span style="color: #800080;">$PrincipalName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$FTPUsername</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;@&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ADDomainName</span>
    <span style="color: #800080;">$AddADUser</span> <span style="color: pink;">=</span> <span style="color: #800080;">$CustomerOU</span>.Create<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;User&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;CN=$FTPUsername&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Description&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$FTPUsername&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;sAMAccountName&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$FTPUsername&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;userPrincipalName&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$PrincipalName&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;DisplayName&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$FTPUsername&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetPassword<span style="color: #000000;">&#40;</span><span style="color: #800080;">$FTPPassword</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Psbase.Invokeset<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;AccountDisabled&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;False&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;userAccountControl&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;65536&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>I didn&#8217;t change Primary Group of my FTP user. Because I don&#8217;t need for ACL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/windows-server/creating-new-ftp-user-on-active-directory-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating New IIS User on Active Directory with Powershell</title>
		<link>http://www.yusufozturk.info/windows-server/creating-new-iis-user-on-active-directory-with-powershell.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=creating-new-iis-user-on-active-directory-with-powershell</link>
		<comments>http://www.yusufozturk.info/windows-server/creating-new-iis-user-on-active-directory-with-powershell.html#comments</comments>
		<pubDate>Tue, 02 Mar 2010 09:40:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting & IIS7]]></category>
		<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[create domain user powershell]]></category>
		<category><![CDATA[create iis user powershell]]></category>
		<category><![CDATA[create new iis user on ad powershell]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1975</guid>
		<description><![CDATA[Creates a new user on Active Directory, sets &#8220;Password never expires&#8221; and changes primary group of user. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Function Add-IISUser [...]]]></description>
			<content:encoded><![CDATA[<p>Creates a new user on Active Directory, sets &#8220;Password never expires&#8221; and changes primary group of user.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">Function</span> Add<span style="color: pink;">-</span>IISUser
<span style="color: #000000;">&#123;</span>
<span style="color: #0000FF;">Param</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Username</span><span style="color: pink;">,</span> <span style="color: #800080;">$Password</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #800080;">$ADDomain</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.DirectoryServices.ActiveDirectory.Domain<span style="color: #000000;">&#93;</span>::GetCurrentDomain<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$ADDomainName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ADDomain</span>.Name
    <span style="color: #800080;">$ADServer</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$ADDomain</span>.InfrastructureRoleOwner.Name.Split<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$FQDN</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;DC=&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ADDomain</span>.Name <span style="color: #FF0000;">-Replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;\.&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;,DC=&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$ADDomain</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span> <span style="color: #800000;">&quot;LDAP://$ADServer/$FQDN&quot;</span>
    <span style="color: #800080;">$CustomerOU</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span> <span style="color: #800000;">&quot;LDAP://$CustomerOU,$FQDN&quot;</span>
    <span style="color: #800080;">$User</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span> <span style="color: #800000;">&quot;LDAP://CN=$Username,$CustomerOU,$FQDN&quot;</span>
    <span style="color: #800080;">$PrincipalName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Username</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;@&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ADDomainName</span>
    <span style="color: #800080;">$AddADUser</span> <span style="color: pink;">=</span> <span style="color: #800080;">$CustomerOU</span>.Create<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;User&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;CN=$Username&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Description&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$Username&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;sAMAccountName&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$Username&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;userPrincipalName&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$PrincipalName&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;DisplayName&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;$Username&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetPassword<span style="color: #000000;">&#40;</span><span style="color: #800080;">$Password</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Psbase.Invokeset<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;AccountDisabled&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;False&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;userAccountControl&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;65536&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$DomainNC</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span><span style="color: #800000;">&quot;LDAP://RootDSE&quot;</span><span style="color: #000000;">&#41;</span>.DefaultNamingContext
    <span style="color: #800080;">$DomainUsers</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span><span style="color: #800000;">&quot;LDAP://CN=Domain Users,CN=Users,$DomainNC&quot;</span>
    <span style="color: #800080;">$DomainUsers</span>.GetInfoEx<span style="color: #000000;">&#40;</span><span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;primaryGroupToken&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span> <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$OldGroupToken</span> <span style="color: pink;">=</span> <span style="color: #800080;">$DomainUsers</span>.Get<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;primaryGroupToken&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$DomainGuests</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>ADSI<span style="color: #000000;">&#93;</span><span style="color: #800000;">&quot;LDAP://CN=IIS_USERS,CN=Users,$DomainNC&quot;</span>
    <span style="color: #800080;">$DomainGuests</span>.GetInfoEx<span style="color: #000000;">&#40;</span><span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;primaryGroupToken&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span> <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$NewGroupToken</span> <span style="color: pink;">=</span> <span style="color: #800080;">$DomainGuests</span>.Get<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;primaryGroupToken&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$DomainGuests</span>.Add<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">String</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$AddADUser</span>.AdsPath<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.Put<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;primaryGroupId&quot;</span><span style="color: pink;">,</span> <span style="color: #800080;">$NewGroupToken</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$AddADUser</span>.SetInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$DomainUsers</span>.Remove<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">String</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$AddADUser</span>.AdsPath<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Our new Primary Group is IIS_USERS as you see. You can change that group name.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/windows-server/creating-new-iis-user-on-active-directory-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Active Directory Information with Powershell</title>
		<link>http://www.yusufozturk.info/windows-server/getting-active-directory-information-with-powershell.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=getting-active-directory-information-with-powershell</link>
		<comments>http://www.yusufozturk.info/windows-server/getting-active-directory-information-with-powershell.html#comments</comments>
		<pubDate>Tue, 02 Mar 2010 09:35:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting & IIS7]]></category>
		<category><![CDATA[Windows Powershell]]></category>
		<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[get ad fqdn powershell]]></category>
		<category><![CDATA[get ad info powershell]]></category>
		<category><![CDATA[get ad primary server name powershell]]></category>
		<category><![CDATA[get domain info powershell]]></category>
		<category><![CDATA[getting ad domain info powershell]]></category>

		<guid isPermaLink="false">http://www.yusufozturk.info/?p=1972</guid>
		<description><![CDATA[My script works on all Active Directory Infrastructures without any change on script. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Function Get-ADInfo &#123; $ADDomain = &#91;System.DirectoryServices.ActiveDirectory.Domain&#93;::GetCurrentDomain&#40;&#41; $ADDomainName = $ADDomain.Name $Netbios = $ADDomain.Name.Split&#40;&#34;.&#34;&#41;&#91;0&#93;.ToUpper&#40;&#41; $ADServer = &#40;$ADDomain.InfrastructureRoleOwner.Name.Split&#40;&#34;.&#34;&#41;&#91;0&#93;&#41; $FQDN = &#34;DC=&#34; + $ADDomain.Name -Replace&#40;&#34;\.&#34;,&#34;,DC=&#34;&#41; &#160; $Results = New-Object Psobject $Results [...]]]></description>
			<content:encoded><![CDATA[<p>My script works on all Active Directory Infrastructures without any change on script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">Function</span> Get<span style="color: pink;">-</span>ADInfo
<span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$ADDomain</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.DirectoryServices.ActiveDirectory.Domain<span style="color: #000000;">&#93;</span>::GetCurrentDomain<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$ADDomainName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ADDomain</span>.Name
    <span style="color: #800080;">$Netbios</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ADDomain</span>.Name.Split<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span>.ToUpper<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$ADServer</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$ADDomain</span>.InfrastructureRoleOwner.Name.Split<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$FQDN</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;DC=&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ADDomain</span>.Name <span style="color: #FF0000;">-Replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;\.&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;,DC=&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #800080;">$Results</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> Psobject
    <span style="color: #800080;">$Results</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> Noteproperty Domain <span style="color: #800080;">$ADDomainName</span>
    <span style="color: #800080;">$Results</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> Noteproperty FQDN <span style="color: #800080;">$FQDN</span>
    <span style="color: #800080;">$Results</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> Noteproperty Server <span style="color: #800080;">$ADServer</span>
    <span style="color: #800080;">$Results</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> Noteproperty Netbios <span style="color: #800080;">$Netbios</span>
    <span style="color: #008080; font-weight: bold;">Write-Output</span> <span style="color: #800080;">$Results</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Usage is pretty simple:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>ADInfo</pre></div></div>

<p>Thats all! :)</p>
<p><strong>Getting Netbios name:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>ADInfo<span style="color: #000000;">&#41;</span>.Netbios</pre></div></div>

<p><strong>Getting FQDN:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>ADInfo<span style="color: #000000;">&#41;</span>.FQDN</pre></div></div>

<p><strong>Getting Active Directory Domain Name:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>ADInfo<span style="color: #000000;">&#41;</span>.$ADDomainName</pre></div></div>

<p><strong>Getting Active Directory Primary Server Name:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>Get<span style="color: pink;">-</span>ADInfo<span style="color: #000000;">&#41;</span>.$ADServer</pre></div></div>

<p>You can use this in your all scripts. You no longer need any active directory information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yusufozturk.info/windows-server/getting-active-directory-information-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
