<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Tech Cafe..</title>
	<atom:link href="http://jkeohan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jkeohan.wordpress.com</link>
	<description>Written and Updated by Joe Keohan</description>
	<lastBuildDate>Thu, 26 Jan 2012 22:01:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jkeohan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Tech Cafe..</title>
		<link>http://jkeohan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jkeohan.wordpress.com/osd.xml" title="The Tech Cafe.." />
	<atom:link rel='hub' href='http://jkeohan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Query Security Log Using Powershell</title>
		<link>http://jkeohan.wordpress.com/2012/01/13/query-security-log-using-powershell/</link>
		<comments>http://jkeohan.wordpress.com/2012/01/13/query-security-log-using-powershell/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 20:30:39 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=1032</guid>
		<description><![CDATA[I&#8217;ve just completed a script that will parse the Windows Security Event log for Event ID&#8217;s of type 4624 (user logons).    Once the events have been retrieved the script then creates and outputs a  custom object populated with the following properties: Account Name DateTime  Type  ( Interactive,Network,Unlock) The script is composed of 2 functions: Find-Matches Query-SecurityLog Query-SecurityLog is the main function and is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=1032&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just completed a script that will parse the Windows Security Event log for Event ID&#8217;s of type 4624 (user logons).    Once the events have been retrieved the script then creates and outputs a  custom object populated with the following properties:</p>
<ul>
<li>Account Name</li>
<li>DateTime </li>
<li>Type  ( Interactive,Network,Unlock)</li>
</ul>
<p>The script is composed of 2 functions:</p>
<ul>
<li>Find-Matches</li>
<li>Query-SecurityLog</li>
</ul>
<p><span style="color:#8a2be2;">Query-SecurityLog</span> is the main function and is responsible for creating and outputing the custom object.  <span style="color:#8a2be2;">Find-Matches</span> is a helper function used to parse the event log message property for the following pattern: <strong>&#8220;Account Name:      SomeUserName&#8221;.   </strong> Prior to incorporating the <span style="color:#8a2be2;">Find-Matches</span> function I had used the <span style="color:#000080;">-Match</span> operator but then realized that pattern was referenced twice  in the message and that the <span style="color:#000080;">-Match</span> operator returns only the first matching expression.  So, if you need to find more than one occurrence of a pattern in raw text, you have to switch over to the <em>RegEx</em> object underlying the <span style="color:#000080;">-Match</span> operator and use it directly.</p>
<p>This left me with 2 possible option that could be used to discover one or more matching values:</p>
<ul>
<li>Select-String (as used in Find-Matches)</li>
<li>[regex]</li>
</ul>
<p>The <span style="color:#8a2be2;">Find-Matches</span> function was something I already had in my repository of scripts so I went that route, however after reading <a href="chapter-13-text-and-regular-expressions">Chapter 13: Text and Regular Expression</a> in the Powershell.com ebook I realized this could of been done with less code by using <span style="color:#008080;">[regex]</span>.</p>
<pre class="PowerShellColorizedScript"><span style="color:#ff4500;">$Pattern</span> <span style="color:#a9a9a9;">=</span> <span style="color:#008080;">[regex]</span><span style="color:#8b0000;">"(?i)\baccount name:\s+\w+\b"</span>
<span style="color:#ff4500;">$Content</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$Pattern</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">matches</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">message</span><span style="color:#000000;">)</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">select</span> <span style="color:#000080;">-prop</span> <span style="color:#8a2be2;">value</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">%</span><span style="color:#000000;">{</span><span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">value</span><span style="color:#000000;">}</span></pre>
<p>The example below demonstrates how Select-String is used in the Find-Matches function to output all matching patterns:</p>
<p><a href="http://jkeohan.files.wordpress.com/2012/01/31.png"><img class="aligncenter size-full wp-image-1042" title="3" src="http://jkeohan.files.wordpress.com/2012/01/31.png?w=600&#038;h=70" alt="" width="600" height="70" /></a><br />
I then used an if\else statemtment block to determine  how many matches were returned and then set the $account parameter accordingly.</p>
<pre class="PowerShellColorizedScript"><span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$content</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Count</span> <span style="color:#a9a9a9;">-eq</span> <span style="color:#800080;">2</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
<span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$content</span><span style="color:#a9a9a9;">[</span><span style="color:#800080;">1</span><span style="color:#a9a9a9;">]</span><span style="color:#000000;">}</span> <span style="color:#00008b;">else</span> <span style="color:#000000;">{</span><span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">=</span>  <span style="color:#ff4500;">$content</span> <span style="color:#000000;">}</span></pre>
<p> I was also suprised to see just how many non-user account logon events were recorded and decided to remove any events that referenced the accounts below:</p>
<ul>
<li>System</li>
<li>IUSER</li>
<li>LOCAL</li>
<li>NETWORK</li>
<li>$ENV:Computername</li>
</ul>
<p>As well as filter the events based on the following Logon Types and assign the $logontype variable accordingly:</p>
<ul>
<li>Interactive (2)</li>
<li>Network (3)</li>
<li>Computer Unlocked (7)</li>
</ul>
<p>This was done using the following code:</p>
<pre class="PowerShellColorizedScript"><span style="color:#ff4500;">$notmatch</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"System|IUSR|LOCAL|NETWORK"</span>
<span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">-notmatch</span> <span style="color:#ff4500;">$notmatch</span><span style="color:#000000;">)</span>  <span style="color:#000000;">{</span>                        

    <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Message</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Pattern</span> <span style="color:#8b0000;">"Logon Type:\s+[2]"</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
    <span style="color:#ff4500;">$logontype</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Interactive"</span> <span style="color:#000000;">}</span>
    <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Message</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Pattern</span> <span style="color:#8b0000;">"Logon Type:\s+[3]"</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
    <span style="color:#ff4500;">$logontype</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Network"</span> <span style="color:#000000;">}</span>
    <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Message</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Pattern</span> <span style="color:#8b0000;">"Logon Type:\s+[7]"</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
    <span style="color:#ff4500;">$logontype</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Computer Unlocked"</span> <span style="color:#000000;">}</span>
    <span style="color:#000000;">}</span></pre>
<p>It was then just a matter of creating and populating the custom object.  There are 2 ways to populate an object once created.  One way is to create the object and then use the Add-Member cmdlet to populate it and the other is to use the -Property property along with splatting ( @{} ).</p>
<ul>
<li>$Obj | Add-Member -Noteproperty NameOfProperty  ValueOfProperty</li>
<li>-Property @{ NameOfProperty = &#8220;Value&#8221; }</li>
</ul>
<p>I choose to go with the Splatting option as it requires less code.</p>
<pre class="PowerShellColorizedScript"><span style="color:#ff4500;">$obj</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">New-Object</span> <span style="color:#8a2be2;">PSObject</span> <span style="color:#000080;">-Property</span> <span style="color:#000000;">@{</span>
       <span style="color:#000000;">User</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$user</span>
       <span style="color:#000000;">Date</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$Date</span>
       <span style="color:#000000;">LogonType</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$LogonType</span>
       <span style="color:#000000;">}</span></pre>
<p> The end result was the following code. </p>
<pre class="PowerShellColorizedScript"><span style="color:#00008b;">Function</span> <span style="color:#8a2be2;">Find-Matches</span> <span style="color:#000000;">{</span>                        

 <span style="color:#00008b;">Param</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$Pattern</span><span style="color:#000000;">)</span>
 <span style="color:#00008b;">Process</span> <span style="color:#000000;">{</span>
  <span style="color:#ff4500;">$_</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-pattern</span> <span style="color:#ff4500;">$Pattern</span> <span style="color:#000080;">-AllMatches</span> <span style="color:#a9a9a9;">|</span>
   <span style="color:#0000ff;">select</span> <span style="color:#000080;">-ExpandProperty</span> <span style="color:#8a2be2;">matches</span> <span style="color:#a9a9a9;">|</span>
   <span style="color:#0000ff;">select</span> <span style="color:#000080;">-ExpandProperty</span> <span style="color:#8a2be2;">value</span>
  <span style="color:#000000;">}</span>
 <span style="color:#000000;">}</span>                        

<span style="color:#00008b;">Function</span> <span style="color:#8a2be2;">Query-SecurityLog</span> <span style="color:#000000;">{</span>               

    <span style="color:#00008b;">Param</span><span style="color:#000000;">(</span>
        <span style="color:#008080;">[int]</span><span style="color:#ff4500;">$MaxEvents</span><span style="color:#a9a9a9;">,</span>
        <span style="color:#008080;">[array]</span><span style="color:#ff4500;">$global:Users</span> <span style="color:#a9a9a9;">=</span> <span style="color:#000000;">@(</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">,</span>
        <span style="color:#008080;">[string]</span><span style="color:#ff4500;">$Comp</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$env:computername</span><span style="color:#a9a9a9;">,</span>
        <span style="color:#ff4500;">$notmatch</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"System|IUSR|LOCAL|NETWORK"</span>            

        <span style="color:#000000;">)</span>                 

    <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$MaxEvents</span><span style="color:#000000;">)</span>
    <span style="color:#000000;">{</span> <span style="color:#ff4500;">$events</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">Get-WinEvent</span> <span style="color:#000080;">-LogName</span> <span style="color:#8a2be2;">security</span> <span style="color:#000080;">-MaxEvents</span> <span style="color:#ff4500;">$MaxEvents</span> <span style="color:#a9a9a9;">|</span>
    <span style="color:#0000ff;">Where-Object</span><span style="color:#000000;">{</span><span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">id</span> <span style="color:#a9a9a9;">-eq</span> <span style="color:#8b0000;">"4624"</span><span style="color:#000000;">}</span>
    <span style="color:#000000;">}</span> <span style="color:#00008b;">Else</span> <span style="color:#000000;">{</span>  <span style="color:#ff4500;">$events</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">Get-WinEvent</span> <span style="color:#000080;">-LogName</span> <span style="color:#8a2be2;">security</span>  <span style="color:#a9a9a9;">|</span>
    <span style="color:#0000ff;">Where-Object</span><span style="color:#000000;">{</span><span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">id</span> <span style="color:#a9a9a9;">-eq</span> <span style="color:#8b0000;">"4624"</span><span style="color:#000000;">}</span><span style="color:#000000;">}</span>            

    <span style="color:#00008b;">Foreach</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span> <span style="color:#00008b;">in</span> <span style="color:#ff4500;">$events</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>                        

    <span style="color:#ff4500;">$content</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">message</span><span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Find-Matches</span> <span style="color:#000080;">-Pattern</span> <span style="color:#8b0000;">"account name:\s+\w+"</span>
    <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$content</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Count</span> <span style="color:#a9a9a9;">-eq</span> <span style="color:#800080;">2</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
    <span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$content</span><span style="color:#a9a9a9;">[</span><span style="color:#800080;">1</span><span style="color:#a9a9a9;">]</span><span style="color:#000000;">}</span> <span style="color:#00008b;">else</span> <span style="color:#000000;">{</span><span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">=</span>  <span style="color:#ff4500;">$content</span> <span style="color:#000000;">}</span>
    <span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">=</span> <span style="color:#000000;">(</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">-split</span> <span style="color:#8b0000;">":"</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">[</span><span style="color:#800080;">1</span><span style="color:#a9a9a9;">]</span><span style="color:#000000;">)</span> <span style="color:#a9a9a9;">-replace</span> <span style="color:#8b0000;">"\s+"</span><span style="color:#a9a9a9;">,</span><span style="color:#8b0000;">""</span>                        

    <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$account</span> <span style="color:#a9a9a9;">-notmatch</span> <span style="color:#ff4500;">$notmatch</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>                        

        <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Message</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Pattern</span> <span style="color:#8b0000;">"Logon Type:\s+[2]"</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
        <span style="color:#ff4500;">$logontype</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Interactive"</span> <span style="color:#000000;">}</span>
        <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Message</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Pattern</span> <span style="color:#8b0000;">"Logon Type:\s+[3]"</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
        <span style="color:#ff4500;">$logontype</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Network"</span> <span style="color:#000000;">}</span>
        <span style="color:#00008b;">if</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Message</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Pattern</span> <span style="color:#8b0000;">"Logon Type:\s+[7]"</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
        <span style="color:#ff4500;">$logontype</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Computer Unlocked"</span> <span style="color:#000000;">}</span>                        

   <span style="color:#ff4500;">$user</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$account</span>
   <span style="color:#ff4500;">$Date</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">TimeCreated</span>
   <span style="color:#ff4500;">$obj</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">New-Object</span> <span style="color:#8a2be2;">PSObject</span> <span style="color:#000080;">-Property</span> <span style="color:#000000;">@{</span>
       <span style="color:#000000;">User</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$user</span>
       <span style="color:#000000;">Date</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$Date</span>
       <span style="color:#000000;">LogonType</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$LogonType</span>
       <span style="color:#000000;">}</span>            

  <span style="color:#ff4500;">$Global:Users</span> <span style="color:#a9a9a9;">+=</span> <span style="color:#ff4500;">$Obj</span>                        

       <span style="color:#000000;">}</span>
    <span style="color:#000000;">}</span>                        

 <span style="color:#0000ff;">write-output</span> <span style="color:#ff4500;">$Global:Users</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#8a2be2;">User</span><span style="color:#a9a9a9;">,</span><span style="color:#8a2be2;">Date</span><span style="color:#a9a9a9;">,</span><span style="color:#8a2be2;">LogonType</span> <span style="color:#a9a9a9;">|</span>
             <span style="color:#0000ff;">Sort</span> <span style="color:#8a2be2;">Date</span> <span style="color:#000080;">-Descending</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Format-Table</span> <span style="color:#000080;">-Auto</span>
<span style="color:#000000;">}</span>                        

<span style="color:#0000ff;">Query-SecurityLog</span> <span style="color:#000080;">-MaxEvents</span> <span style="color:#800080;">1000</span></pre>
<p>The output of Query-SecurityLog  is:</p>
<p><a href="http://jkeohan.files.wordpress.com/2012/01/21.png"><img title="2" src="http://jkeohan.files.wordpress.com/2012/01/21.png?w=600&#038;h=204" alt="" width="600" height="204" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/1032/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/1032/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/1032/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/1032/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/1032/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/1032/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/1032/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/1032/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/1032/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/1032/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/1032/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/1032/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/1032/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/1032/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=1032&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2012/01/13/query-security-log-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2012/01/31.png" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2012/01/21.png" medium="image">
			<media:title type="html">2</media:title>
		</media:content>
	</item>
		<item>
		<title>Powershell Objects and .PS1XML Files</title>
		<link>http://jkeohan.wordpress.com/2012/01/09/powershell-ps1xml-formating-files/</link>
		<comments>http://jkeohan.wordpress.com/2012/01/09/powershell-ps1xml-formating-files/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 22:22:08 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=1013</guid>
		<description><![CDATA[Anyone who uses powershell on a regular basis knows that the output of any powershell cmdlet is of an object type.  Powershell produces objects. For example let&#8217;s look at the objects produced by two cmdlets that essentially do the same thing: Get-Eventlog and Get-WinEvent.   The below example uses the GetType() method to display the object type for an eventlog. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=1013&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Anyone who uses powershell on a regular basis knows that the output of any powershell cmdlet is of an object type.  Powershell produces objects. For example let&#8217;s look at the objects produced by two cmdlets that essentially do the same thing: Get-Eventlog and Get-WinEvent.   The below example uses the GetType() method to display the object type for an eventlog.</p>
<pre class="PowerShellColorizedScript"><span style="color:#000000;">(</span><span style="color:#0000ff;">Get-Eventlog</span> <span style="color:#000080;">-List</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">1</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Gettype</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">FT</span> <span style="color:#000080;">-auto</span>
<span style="color:#000000;">(</span><span style="color:#0000ff;">Get-WinEvent</span> <span style="color:#000080;">-Listlog</span> <span style="color:#8a2be2;">Application</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Gettype</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">FT</span> <span style="color:#000080;">-auto</span></pre>
<p><a href="http://jkeohan.files.wordpress.com/2012/01/1.png"><img title="1" src="http://jkeohan.files.wordpress.com/2012/01/1.png?w=600&#038;h=152" alt="" width="600" height="152" /></a></p>
<p>Both produce different objects, Eventlog and EventLogConfiguration.  The output of these objects is associated with a powershell formating file (.ps1xml) which defines the properties they will display.</p>
<p>The example below shows the output as it pertains to Get-Eventlog and Get-Winevent.</p>
<pre class="PowerShellColorizedScript"><span style="color:#000000;">(</span><span style="color:#0000ff;">Get-Eventlog</span> <span style="color:#000080;">-List</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">1</span><span style="color:#000000;">)</span>
<span style="color:#000000;">(</span><span style="color:#0000ff;">Get-WinEvent</span> <span style="color:#000080;">-Listlog</span> <span style="color:#8a2be2;">Application</span><span style="color:#000000;">)</span></pre>
<p><a href="http://jkeohan.files.wordpress.com/2012/01/2.png"><img title="2" src="http://jkeohan.files.wordpress.com/2012/01/2.png?w=600&#038;h=131" alt="" width="600" height="131" /></a></p>
<p>Although they both reference the same event log (Application) they are configured to display different properties, even though some of them reference the same values, like Log and LogName or Entries and RecordCount.</p>
<p>I then was curious which formatting files were associate with each object type, so I decided to view which .ps1xml files existed and ran the following command to browse the $pshome directory and filter for only *.ps1xml files.</p>
<pre class="PowerShellColorizedScript"><span style="color:#0000ff;">dir</span> <span style="color:#8a2be2;">$pshome\*</span> <span style="color:#000080;">-include</span> <span style="color:#8a2be2;">*.ps1xml</span></pre>
<p><a href="http://jkeohan.files.wordpress.com/2012/01/3.png"><img class="aligncenter size-full wp-image-1016" title="3" src="http://jkeohan.files.wordpress.com/2012/01/3.png?w=600&#038;h=231" alt="" width="600" height="231" /></a></p>
<p>My next step was to parse these files using Select-String  for references to the object types (Eventlog and EventLogConfiguration) but decided that the process should be automated and created a function that would create a custom object with the properties of my choosing.   This would also be useful to demo for the workshop I&#8217;m putting together called <em><strong>&#8220;Using Powershell to View Events and Event Logs&#8221;</strong></em> (not sure I did the title so it may change shortly).</p>
<p>Anyway, the result of all this was the creation of the <em><strong>Get-EventLogBaseObjects </strong></em>function.</p>
<pre class="PowerShellColorizedScript"><span style="color:#00008b;">Function</span> <span style="color:#8a2be2;">Get-EventLogBaseObjects</span> <span style="color:#000000;">{</span>
 <span style="color:#ff4500;">$Array</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Get-EventLog"</span><span style="color:#a9a9a9;">,</span><span style="color:#8b0000;">"Get-WinEvent"</span>
 <span style="color:#ff4500;">$global:newarray</span> <span style="color:#a9a9a9;">=</span><span style="color:#000000;">@(</span><span style="color:#000000;">)</span>                                                

     <span style="color:#00008b;">Switch</span> <span style="color:#000000;">(</span><span style="color:#ff4500;">$Array</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>                                                

 <span style="color:#8b0000;">"Get-Eventlog"</span> <span style="color:#000000;">{</span>
    <span style="color:#ff4500;">$GetEventLog</span> <span style="color:#a9a9a9;">=</span> <span style="color:#000000;">(</span><span style="color:#0000ff;">get-eventlog</span> <span style="color:#000080;">-list</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#000080;">-first</span> <span style="color:#800080;">1</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">gettype</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>
    <span style="color:#ff4500;">$XMLFile</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Path</span> <span style="color:#8a2be2;">$PSHOME\*.ps1xml</span> <span style="color:#000080;">-Pattern</span> <span style="color:#ff4500;">$GetEventlog</span> <span style="color:#a9a9a9;">|</span>
        <span style="color:#0000ff;">Select</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">1</span>
    <span style="color:#ff4500;">$Obj</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">New-Object</span> <span style="color:#8a2be2;">PSObject</span> <span style="color:#000080;">-Property</span> <span style="color:#000000;">@{</span>
            <span style="color:#000000;">Cmdlet</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Get-Eventlog"</span>
            <span style="color:#000000;">SystemType</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$GetEventLog</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">UnderlyingSystemType</span>
            <span style="color:#000000;">XMLFile</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$XMLFile</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">filename</span>
            <span style="color:#000000;">}</span>
    <span style="color:#ff4500;">$global:newarray</span> <span style="color:#a9a9a9;">+=</span> <span style="color:#ff4500;">$obj</span>
    <span style="color:#000000;">}</span>                                    

 <span style="color:#8b0000;">"Get-WinEvent"</span> <span style="color:#000000;">{</span>
    <span style="color:#ff4500;">$GetWinEvent</span> <span style="color:#a9a9a9;">=</span> <span style="color:#000000;">(</span><span style="color:#0000ff;">Get-WinEvent</span> <span style="color:#000080;">-Listlog</span> <span style="color:#8a2be2;">Application</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">gettype</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>
    <span style="color:#ff4500;">$XMLFile</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">Select-String</span> <span style="color:#000080;">-Path</span> <span style="color:#8a2be2;">$PSHOME\*.ps1xml</span> <span style="color:#000080;">-Pattern</span> <span style="color:#ff4500;">$GetWinEvent</span> <span style="color:#a9a9a9;">|</span>
        <span style="color:#0000ff;">Select</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">1</span>
    <span style="color:#ff4500;">$Obj</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">New-Object</span> <span style="color:#8a2be2;">PSObject</span> <span style="color:#000080;">-Property</span> <span style="color:#000000;">@{</span>
            <span style="color:#000000;">Cmdlet</span> <span style="color:#a9a9a9;">=</span> <span style="color:#8b0000;">"Get-WinEvent"</span>
            <span style="color:#000000;">SystemType</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$GetWinEvent</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">UnderlyingSystemType</span>
            <span style="color:#000000;">XMLFile</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$XMLFile</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">filename</span>
            <span style="color:#000000;">}</span>
    <span style="color:#ff4500;">$global:newarray</span> <span style="color:#a9a9a9;">+=</span> <span style="color:#ff4500;">$obj</span>
     <span style="color:#000000;">}</span>
 <span style="color:#000000;">}</span>
 <span style="color:#0000ff;">write-output</span> <span style="color:#ff4500;">$global:NewArray</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#8a2be2;">Cmdlet</span><span style="color:#a9a9a9;">,</span><span style="color:#8a2be2;">SytemType</span><span style="color:#a9a9a9;">,</span><span style="color:#8a2be2;">XMLFile</span> <span style="color:#a9a9a9;">|</span>
        <span style="color:#0000ff;">Format-Table</span> <span style="color:#000080;">-AutoSize</span>
<span style="color:#000000;">}</span>                        

<span style="color:#0000ff;">Get-EventLogBaseObjects</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/1013/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/1013/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/1013/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/1013/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/1013/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/1013/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/1013/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/1013/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=1013&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2012/01/09/powershell-ps1xml-formating-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2012/01/1.png" medium="image">
			<media:title type="html">1</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2012/01/2.png" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2012/01/3.png" medium="image">
			<media:title type="html">3</media:title>
		</media:content>
	</item>
		<item>
		<title>Determine Pipeline Input</title>
		<link>http://jkeohan.wordpress.com/2012/01/07/determine-pipeline-input/</link>
		<comments>http://jkeohan.wordpress.com/2012/01/07/determine-pipeline-input/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 21:01:36 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=996</guid>
		<description><![CDATA[There was a recent post on the Powershell Forums titled Finding Function Name in which the user wanted to know if there was anyway to determine which cmdlet or function was being used to send input down the pipeline.  In order to assist I first needed to do some research as I was unsure how to make [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=996&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There was a recent post on the Powershell Forums titled <a title="Finding Function Name" href="http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/18fa5047-fad5-4c1b-a9ab-f87efa853c84">Finding Function Name</a> in which the user wanted to know if there was anyway to determine which cmdlet or function was being used to send input down the pipeline.  In order to assist I first needed to do some research as I was unsure how to make this determination.  It just so happened that the first response was by Kazun (PS MVP..enough said.. ) and he suggested using $MyInvocation.Line. </p>
<p>So upon doing a google search I came across the following article <a href="http://poshoholic.com/2008/03/18/powershell-deep-dive-using-myinvocation-and-invoke-expression-to-support-dot-sourcing-and-direct-invocation-in-shared-powershell-scripts/">PowerShell Deep Dive: Using $MyInvocation</a> by Kirk Munro which went into great detail on how to use the $MyInvocation variable to make a similiar distinction.  From that article I came up with  the following script to demo $MyInvocation.  It includes 4 functions.  The one that anaylzes the pipeline input is <span style="color:#0000ff;">Out-Name. </span>  Here is the script&#8230;</p>
<pre class="PowerShellColorizedScript"><span style="color:#00008b;">Function</span> <span style="color:#8a2be2;">Get-Svc</span> <span style="color:#000000;">{</span>
      <span style="color:#0000ff;">Get-Service</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">select</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">2</span>
    <span style="color:#000000;">}</span>
<span style="color:#00008b;">Function</span> <span style="color:#8a2be2;">Get-Proc</span> <span style="color:#000000;">{</span>
      <span style="color:#0000ff;">Get-Process</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">2</span>
    <span style="color:#000000;">}</span>
<span style="color:#00008b;">Function</span> <span style="color:#8a2be2;">Get-File</span> <span style="color:#000000;">{</span>
      <span style="color:#0000ff;">GCI</span> <span style="color:#8a2be2;">c:\</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">2</span>
    <span style="color:#000000;">}</span>            

<span style="color:#00008b;">Function</span> <span style="color:#8a2be2;">Out-Name</span> <span style="color:#000000;">{</span>
    <span style="color:#00008b;">param</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$name</span><span style="color:#000000;">)</span>            

    <span style="color:#00008b;">Begin</span> <span style="color:#000000;">{</span>
       <span style="color:#ff4500;">$global:Invocation</span> <span style="color:#a9a9a9;">=</span> <span style="color:#ff4500;">$MyInvocation</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">line</span>
    <span style="color:#000000;">}</span>            

    <span style="color:#00008b;">Process</span><span style="color:#000000;">{</span>
       <span style="color:#00008b;">if</span><span style="color:#000000;">(</span> <span style="color:#ff4500;">$global:Invocation</span> <span style="color:#a9a9a9;">-match</span> <span style="color:#8b0000;">"Get-Svc"</span> <span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
       <span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">name</span>
       <span style="color:#000000;">}</span>
       <span style="color:#00008b;">Elseif</span> <span style="color:#000000;">(</span> <span style="color:#ff4500;">$global:Invocation</span> <span style="color:#a9a9a9;">-match</span> <span style="color:#8b0000;">"Get-Proc"</span> <span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
       <span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">vm</span>
       <span style="color:#000000;">}</span>
       <span style="color:#00008b;">Else</span> <span style="color:#000000;">{</span> <span style="color:#0000ff;">Write-Host</span> <span style="color:#8b0000;">"Get-Svc was not used"</span> <span style="color:#000000;">}</span>
    <span style="color:#000000;">}</span>
  <span style="color:#000000;">}</span>            

<span style="color:#0000ff;">Get-Svc</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">out-Name</span>
<span style="color:#006400;">#Get-Proc | out-name</span>
<span style="color:#006400;">#Get-File | Out-Name</span></pre>
<pre class="PowerShellColorizedScript"> </pre>
<p>The script was created soley to demo $MyInvocation but could be altered (as with any script) to make it fit your needs.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/996/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/996/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/996/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/996/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/996/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/996/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/996/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/996/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/996/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/996/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/996/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/996/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/996/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/996/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=996&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2012/01/07/determine-pipeline-input/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>
	</item>
		<item>
		<title>Powershell Execution Policies</title>
		<link>http://jkeohan.wordpress.com/2011/01/16/powershell-execution-policies/</link>
		<comments>http://jkeohan.wordpress.com/2011/01/16/powershell-execution-policies/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 23:19:03 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=912</guid>
		<description><![CDATA[Windows Powershell execution polices let you determine the conditions under which Powershell loads configuration files (.ps1xml), module script files (.psm1) and scripts (.ps1).    By defaut Powershell doesn&#8217;t permit any of these files as it&#8217;s default execution policy is set to Restricted.  The available execution policies are as follows and can be found by running Help About_Execution_Policies There [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=912&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Windows Powershell execution polices let you determine the conditions under which Powershell loads configuration files (.ps1xml), module script files (.psm1) and scripts (.ps1).    By defaut Powershell doesn&#8217;t permit any of these files as it&#8217;s default execution policy is set to Restricted.  The available execution policies are as follows and can be found by running <em><span style="color:#000080;"><strong>Help About_Execution_Policies<span id="more-912"></span></strong></span></em></p>
<p><a href="http://jkeohan.files.wordpress.com/2011/01/help-about_ex_po.jpg"><img class="alignleft size-full wp-image-914" title="help about_ex_po" src="http://jkeohan.files.wordpress.com/2011/01/help-about_ex_po.jpg?w=600" alt=""   /></a></p>
<p>There are 5 available scopes that can be configured using the policies above and they can viewed by running <span style="color:#000080;"><em><strong>Get-Executionpolicy -List</strong></em>.</span></p>
<p><a href="http://jkeohan.files.wordpress.com/2011/01/get-exectuionpolicy-list-ft-auto.jpg"><img class="alignleft size-full wp-image-913" title="Get-Exectuionpolicy-List-FT -auto" src="http://jkeohan.files.wordpress.com/2011/01/get-exectuionpolicy-list-ft-auto.jpg?w=600" alt=""   /></a></p>
<p>Powershell evaluates the current execution policy based on scope  precedence, with MachinePolicy being the highest and LocalMachine the lowest.   Both MachinePolicy and UserPolicy can only be configured via Group Policy and are located in Computer or Users Configuration\Policies\Administrative Templates\Windows Components\Windows Powershell.   Both GPO scopes can only be configured to use Unrestricted, RemoteSigned and AllSigned which makes them more restricted.  The remaining scopes can take advantage of all policies with Bypass being the most lenient.   By default all scopes are Undefined which set&#8217;s the execution policy to Restricted thereby no scripts are allowed to run.   The execution policy can be configured for the current scope by using <em><span style="color:#000080;"><strong>Set-Executionpolicy</strong></span></em> which defines the LocalMachine scope.</p>
<p><a href="http://jkeohan.files.wordpress.com/2011/01/set-exepol.jpg"><img class="alignleft size-full wp-image-915" title="set-exepol" src="http://jkeohan.files.wordpress.com/2011/01/set-exepol.jpg?w=600" alt=""   /></a></p>
<p>As you can ssee I&#8217;ve changed the default scope to RemoteSigned, which permits local scripts to run but requires scripts downloaded from the Internet to be digitally signed.  It&#8217;s possible to change the CurrentUser scope by using the -Scope parameter.  Below I&#8217;ve changed the scope for the CurrentUser to Bypass.</p>
<p><a href="http://jkeohan.files.wordpress.com/2011/01/set-exepol-scop.jpg"><img class="alignleft size-full wp-image-916" title="set-exepol -scop" src="http://jkeohan.files.wordpress.com/2011/01/set-exepol-scop.jpg?w=600" alt=""   /></a></p>
<p>This now permits the current user the ability to run all scripts but all other users will need to have remote scripts digitaly signed.   I recently needed to execute a powershell script in the All Programs\Startup folder on a machine that is running the default execution policy of Restricted.   This was possible by creating a .bat file that included the following line of code:</p>
<p><em><span style="color:#000080;"><strong>Powershell -executionpolicy bypass -file &#8220;C:\test\install.ps1&#8243;</strong></span></em></p>
<p>This runs the in the Process scope and affects only the current Powershell session.  The execution policy is stored in the $PSExecutionPolicyPreference Environmental variable.  This value is deleted when the session in which the policy is set is closed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/912/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=912&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2011/01/16/powershell-execution-policies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2011/01/help-about_ex_po.jpg" medium="image">
			<media:title type="html">help about_ex_po</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2011/01/get-exectuionpolicy-list-ft-auto.jpg" medium="image">
			<media:title type="html">Get-Exectuionpolicy-List-FT -auto</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2011/01/set-exepol.jpg" medium="image">
			<media:title type="html">set-exepol</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2011/01/set-exepol-scop.jpg" medium="image">
			<media:title type="html">set-exepol -scop</media:title>
		</media:content>
	</item>
		<item>
		<title>Migrate DHCP Server Settings Using Powershell</title>
		<link>http://jkeohan.wordpress.com/2011/01/10/using-migrate-server-settings-using-powershell/</link>
		<comments>http://jkeohan.wordpress.com/2011/01/10/using-migrate-server-settings-using-powershell/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 15:34:50 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=904</guid>
		<description><![CDATA[During my preparation to teach the &#8220;Updating Your Skills to Server 2008 R2&#8243; class, I saw lot&#8217;s of potential to use Powershell to automate some of the mundane tasks, such as creating files and assigning permissions (Module 2) or restoring an AD Computer Object (Module 4) to the more advanced such as using the new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=904&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>During my preparation to teach the &#8220;Updating Your Skills to Server 2008 R2&#8243; class, I saw lot&#8217;s of potential to use Powershell to automate some of the mundane tasks, such as creating files and assigning permissions (Module 2) or restoring an AD Computer Object (Module 4) to the more advanced such as using the new Server Migration Tools to migrate the DHCP service from DC1 to SVR1 (Module 1).<span id="more-904"></span></p>
<p>I  tried to use functions to perform these tasks which I then had the students dot source (. ./name.ps1) to import then into the current Powershell console.   The functions included Help and Examples which could be copied\pasted for ease of use.   Most of the code was &#8220;on point&#8221; but there were a few syntax errors I missed along the way, which have now been resolved.</p>
<p>Below is the &#8220;Server Migration&#8221; script.</p>
<p>Function Migrate-ServerSettings {</p>
<p>&lt;#</p>
<p>.SYNOPSIS</p>
<p>The Migrate-ServerSettings function was created to export\import the DHCP service\configurations using the</p>
<p>&#8220;Microsoft Windows Server Migration Tools&#8221;.  It queries the existence of several required components and</p>
<p>installs then if needed.  It performs the following</p>
<p>            1.  Queries Get-Command for &#8220;Get-Windowsfeature&#8221; and if not found runs &#8220;Import-Module ServerManager&#8221;</p>
<p>            2.  Queries Get-Windowsfeature for &#8220;Migration&#8221; and if not found runs &#8220;Add-WindowsFeature Migration&#8221;</p>
<p>            3.  Queries Get-Pssnapin for &#8220;Microsoft.Windows.Servermanager.Migration&#8221; and if not found runs &#8220;Add-PSSnapinMicrosoft.Windows.Servermanager.Migration&#8221;</p>
<p>            4.  Queries the DHCPServer service and stops the service if running</p>
<p>            5.  Evaluates $Migrate variable and if value is export runs &#8220;Export-SmigServerSetting&#8221;.  If value is import runs &#8220;Import-SmigServerSetting&#8221;</p>
<p>I&#8217;ve included some Write-Debug lines to troubleshoot any issue with the $service variable as the paramater value you will use is</p>
<p>DHCP, but the service name is DHCPServer.  The script would have to be adjusted to accomodate other services.</p>
<p>.EXAMPLE</p>
<p>Migrate-ServerSettings -Service DHCP -Path &#8220;\\NYC-DC1.contoso.com\export&#8221; -Migrate Export</p>
<p>.EXAMPLE</p>
<p>Migrate-ServerSettings -Service DHCP -Path &#8220;\\NYC-DC1.contoso.com\export&#8221; -Migrate Import</p>
<p>#&gt;</p>
<p>Param(</p>
<p>    [string]$Service,</p>
<p>    [string]$Path,</p>
<p>    [string]$migrate</p>
<p>    )</p>
<p>if(!(<strong>get-command</strong> * | <strong>where</strong>{$_.name -eq &#8220;get-windowsfeature&#8221;})) {</p>
<p>    write-host &#8220;`nServerManager Module being installed`n&#8221; -Fore Yellow</p>
<p>    <strong>import-module</strong> servermanager} else {</p>
<p>        <strong>write-host</strong> &#8220;`nServerManager Module already installed`n&#8221; <em>-fore</em> Green</p>
<p>        }</p>
<p>if(!(get-windowsfeature -name Migration).installed -eq &#8220;False&#8221;) {</p>
<p>    <strong>write-host</strong> &#8220;Installing Feature &#8216;Windows Server Migration Tools`n&#8221; <em>-Fore</em> Yellow</p>
<p>    add-windowsfeature Migration} else {</p>
<p>        <strong>write-host</strong> &#8220;Windows Server Migration Tools Already Installed`n&#8221; <em>-fore</em> Green</p>
<p>        }</p>
<p>if(!(<strong>get-pssnapin</strong> | <strong>where</strong>{$_.name -like &#8220;*Migration*&#8221;})) {</p>
<p>    <strong>write-host</strong> &#8220;Importing Microsoft.WIndows.ServerManager.Migration Snapin`n&#8221; <em>-fore</em> Yellow</p>
<p>    <strong>Add-PSSnapin</strong> Microsoft.Windows.ServerManager.Migration} else {</p>
<p>        <strong>write-host</strong> &#8220;Microsoft.WIndows.ServerManager.Migration Snapin Already Imported`n&#8221; <em>-fore</em> Green</p>
<p>        }</p>
<p>$svc = $service + &#8220;server&#8221;</p>
<p>if(<strong>get-service</strong> | <strong>where</strong>{$_.name -like &#8220;$svc&#8221;}) {</p>
<p>    if ((<strong>get-service</strong> $svc).status -eq &#8220;Running&#8221;) {<strong>stop-service</strong> $svc <em>-force</em>}</p>
<p>    }</p>
<p><strong>write-debug</strong> &#8220;&#8216;$service is $service&#8221;</p>
<p>if($migrate -eq &#8220;export&#8221;) { Export-SmigServerSetting -featureID $Service -path $path -Verbose</p>
<p>    } else { Import-SmigServerSetting -featureID $Service -path $path -Verbose }</p>
<p>     } #end function</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/904/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/904/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/904/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/904/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/904/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/904/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/904/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/904/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/904/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/904/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/904/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/904/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/904/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/904/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=904&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2011/01/10/using-migrate-server-settings-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>
	</item>
		<item>
		<title>Appending a Function to a Powershell Profile</title>
		<link>http://jkeohan.wordpress.com/2010/12/29/appending-a-function-to-a-powershell-profile/</link>
		<comments>http://jkeohan.wordpress.com/2010/12/29/appending-a-function-to-a-powershell-profile/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 19:40:31 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=872</guid>
		<description><![CDATA[Powershell profiles provide the opportunity to extend custom functionality either via the console or a scripting engine like PowerGui or the ISE.  They are normal PS scripts and end with a .ps1 file extension. Like all PS scripts they can be edited in notepad, ISE, PowerGUI (my favorite) or any other script\text editor.   Profiles can be used to import [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=872&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Powershell profiles provide the opportunity to extend custom functionality either via the console or a scripting engine like PowerGui or the ISE.  They are normal PS scripts and end with a .ps1 file extension. Like all PS scripts they can be edited in notepad, ISE, PowerGUI (my favorite) or any other script\text editor.<span id="more-872"></span>   Profiles can be used to import modules, such as ServerManager, Applocker, BestPractices or customized settings such as Aliases,Functionc,etc..</p>
<p>Let&#8217;s take a look at the available modules for import on this machine.</p>
<p><span style="color:#0000ff;">Get-Module <span style="color:#0000a0;">-ListAvailable</span></span></p>
<p><a href="http://jkeohan.files.wordpress.com/2010/12/get-module.jpg"><img class="alignleft size-full wp-image-874" title="get-module" src="http://jkeohan.files.wordpress.com/2010/12/get-module.jpg?w=600" alt=""   /></a></p>
<p> <br />
The box I&#8217;m running is Server 2008R2 and on a default install includes only 7 modules (or there about). I&#8217;ve installed the additional tools such as <a href="http://pscx.codeplex.com/releases/view/45101">PSCX</a> and the <a href="http://code.msdn.microsoft.com/PowerShellPack">MSDN  PowershellPack</a> , both of which have added extended the default list of modules.</p>
<p>When Powerhsell starts, it looks for the existence of 4 specific profiles and runs them in the following order with the end result being a sum total of all existing profile settings, unless there is a conflict and then the more specific profile setting takes precednece.</p>
<ol>
<li>All Users, All Hosts</li>
<li>All Users &#8211; Powershell or ISE (depending which one is being used)</li>
<li>Current User, All Hosts</li>
<li>Current User &#8211; Powershell or ISE (depending which one is being used)</li>
</ol>
<p>Profiles don&#8217;t exist by default and must be created and thier location is defined in the $Profile variable.  I&#8217;ve created the below code to select only the Name and Path for the profiles.<br />
<span style="color:#0000ff;"><br />
$Profile | Get-Member |?{$_.membertype -eq &#8220;note*&#8221;} | Select  name,@{label=&#8221;Path&#8221;;e={$_.definition -replace  &#8220;^.+=&#8221;,&#8221;"| Format-Table -autosize</span></p>
<p><a href="http://jkeohan.files.wordpress.com/2010/12/profile_paths.jpg"><img title="Profile_Paths" src="http://jkeohan.files.wordpress.com/2010/12/profile_paths.jpg?w=955&#038;h=97" alt="" width="955" height="97" /></a></p>
<p>The potential that lies in loading preconfigured profiles is endless and as a small example I&#8217;ve decided to create a Active Directory Logon Script that will determine if the <em>CurrentUserCurrentHost</em> profile exists and if not, will create it, and then continue to populate it with a simple function called <span style="color:#0000ff;">Get-WMIClass.</span></p>
<pre class="PowerShellColorizedScript"><span style="color:#0000ff;">If</span> <span style="color:#000000;">(</span><span style="color:#ff0000;">!</span><span style="color:#000000;">(</span> <span style="color:#0000ff;">Test-Path</span> <span style="color:#008080;">$Profile</span> <span style="color:#000000;">)</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
<span style="color:#0000ff;">New-Item</span> <span style="color:#008080;">$Profile</span>  <span style="color:#0000ff;">-Type</span>  File  <span style="color:#008080;">-Force</span>
<span style="color:#000000;">}</span> <span style="color:#0000ff;">Else</span>  <span style="color:#000000;">{</span>
<span style="color:#008080;">$A</span>  =  <span style="color:#0000ff;">Get-Content</span>  <span style="color:#008080;">$Profile</span> <span style="color:#000000;">}</span>

<span style="color:#0000ff;">If</span> <span style="color:#000000;">(</span><span style="color:#ff0000;">!</span><span style="color:#000000;">(</span> <span style="color:#008080;">$A</span> <span style="color:#ff0000;">-Like</span>  "*Get-WMIClass*"  <span style="color:#000000;">)</span><span style="color:#000000;">)</span>  <span style="color:#000000;">{</span>
 <span style="color:#008080;">$Content</span> = @(
 "Function GET-WMIClass {"
 '$NS="Root\CIMV2"'
 '$Class=$args[0]'
 'Get-WMIObject -Namespace $NS -Class $Class'
 "}"
 )
 <span style="color:#008080;">$Content</span> <span style="color:#0000ff;">|</span> <span style="color:#0000ff;">Add-Content</span> <span style="color:#008080;">$Profile</span> <span style="color:#0000ff;">-Encoding</span>  UTF8
<span style="color:#000000;">}</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/872/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=872&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2010/12/29/appending-a-function-to-a-powershell-profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/12/get-module.jpg" medium="image">
			<media:title type="html">get-module</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/12/profile_paths.jpg" medium="image">
			<media:title type="html">Profile_Paths</media:title>
		</media:content>
	</item>
		<item>
		<title>Domain Controller Automation Using Powershell</title>
		<link>http://jkeohan.wordpress.com/2010/12/28/domain-controller-automation-using-powershell/</link>
		<comments>http://jkeohan.wordpress.com/2010/12/28/domain-controller-automation-using-powershell/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 18:37:30 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=865</guid>
		<description><![CDATA[I&#8217;ve recently completed the following Microsoft Test Lab Guides: Base Configuration Demonstrate DirectAccess The DirectAccess lab required that the Base Configuration be setup first and considering that both labs were time consuming and, at times remedial, I decided to make the process more streamlined and automated by using Powershell to create a script ( for complete automation ) which I could  then convert into a module [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=865&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://jkeohan.files.wordpress.com/2010/12/fucntion-configure-domaincontroller.jpg"></a>I&#8217;ve recently completed the following Microsoft Test Lab Guides:</p>
<ul>
<li><a href="http://technet.microsoft.com/en-us/library/gg314535(WS.10).aspx">Base Configuration</a></li>
<li><a href="http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&amp;FamilyID=8d47ed5f-d217-4d84-b698-f39360d82fac">Demonstrate DirectAccess</a></li>
</ul>
<p>The DirectAccess lab required that the Base Configuration be setup first and considering that both labs were time consuming and, at times remedial, I decided to make the process more streamlined and automated by using Powershell to create a script ( for complete automation ) which I could  then convert into a module ( for a more step by step approach ).  I&#8217;m still in the begining phase of automating the Base Configuration but I&#8217;ve already created a few functions, one of which will turn a standalone server into the first Domain Controller for the Corp.Contoso.Com domain. <span id="more-865"></span></p>
<p><a href="http://jkeohan.files.wordpress.com/2010/12/fucntion-configure-domaincontroller.jpg"><img title="Fucntion Configure-DomainController" src="http://jkeohan.files.wordpress.com/2010/12/fucntion-configure-domaincontroller.jpg?w=1024&#038;h=601" alt="" width="1024" height="601" /></a></p>
<p>I&#8217;ve tested it out serveral times using Hyerp-V and snapshots (another time saver) and it works perfectly.   I was going to include the unattend.txt file separately along with script but decided to have the function create it so that the function could be used independently and would be less prone to error.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/865/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/865/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/865/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/865/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/865/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/865/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/865/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/865/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/865/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/865/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/865/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/865/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/865/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/865/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=865&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2010/12/28/domain-controller-automation-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/12/fucntion-configure-domaincontroller.jpg" medium="image">
			<media:title type="html">Fucntion Configure-DomainController</media:title>
		</media:content>
	</item>
		<item>
		<title>Deleting Default Shares Using Powershell &#8211; Part 2</title>
		<link>http://jkeohan.wordpress.com/2010/11/29/deleting-default-shares-using-powershell-part-2/</link>
		<comments>http://jkeohan.wordpress.com/2010/11/29/deleting-default-shares-using-powershell-part-2/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 23:48:44 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=835</guid>
		<description><![CDATA[Having removed the default administrative shares in Part 1 has provided a minimal increase in my security confidence index for the time being but knowing all to well that when the machine is rebooted the shares will return once again takes me back to where I started.    This means that we must take it one step further and edit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=835&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://jkeohan.files.wordpress.com/2010/11/get-itemproperty.jpg"></a><a href="http://jkeohan.files.wordpress.com/2010/11/final_script_delete_default_admin_shares.jpg"></a><a href="http://jkeohan.files.wordpress.com/2010/11/final_script_delete_default_admin_shares1.jpg"></a><a href="http://jkeohan.files.wordpress.com/2010/11/regscript.jpg"></a>Having removed the default administrative shares in Part 1 has provided a minimal increase in my security confidence index for the time being but knowing all to well that when the machine is rebooted the shares will return once again takes me back to where I started.    This means that we must take it one step further and edit the registry to permanately remove them going forward. <br />
<span id="more-835"></span></p>
<p>One of the neat things about Powershell is that it creates a set of PSDrives that allow the browsing of different data types using the same set of commands as though they were directories.  The PSDrives  on my machine are the following:</p>
<p><em><strong>Get-PSDrive | Format-Table  -Auto </strong></em></p>
<p><em><a href="http://jkeohan.files.wordpress.com/2010/11/get-psdrive_ft_auto_wrap.jpg"><img class="alignleft size-full wp-image-836" title="get-psdrive_ft_auto_wrap" src="http://jkeohan.files.wordpress.com/2010/11/get-psdrive_ft_auto_wrap.jpg?w=600" alt=""   /></a></em></p>
<p>The psdrives displayed will have a corresponding Provider that exposes it&#8217;s data store and can be viewed using Get-PSProvider. </p>
<p><em><strong>Get-PSProvider | Format-Table  -Auto</strong></em></p>
<p><em><strong><a href="http://jkeohan.files.wordpress.com/2010/11/get-psprovider_ft_auto.jpg"><img title="get-psprovider_ft_auto" src="http://jkeohan.files.wordpress.com/2010/11/get-psprovider_ft_auto.jpg?w=959&#038;h=158" alt="" width="959" height="158" /></a></strong></em></p>
<p><em><strong><a href="http://jkeohan.files.wordpress.com/2010/11/get-psprovider_ft_auto.jpg"></a></strong></em></p>
<p><em>S</em>ince Powershell includes a set of cmdlets that are designed to manage items in a data store we can enter a PSDrive using Set-Location, and display it&#8217;s contents using Get-ChildItem.   The HKLM registry hive is what needs to be edited, specifically HKLM:\System\CurrentControlSet\Services\LanManServer\Parameters so let&#8217;s move into that key.   What you will notice is that  the &#8220;directories&#8221; (in this case Keys) are condensed, something specific to the Registry provider.</p>
<p><a href="http://jkeohan.files.wordpress.com/2010/11/sl-hklm.jpg"><img class="alignleft size-full wp-image-840" title="sl hklm" src="http://jkeohan.files.wordpress.com/2010/11/sl-hklm.jpg?w=600" alt=""   /></a></p>
<p>In order to see the actual data types in the Parameters key, &#8220;Get-ItemProperty . &#8220;must be used.  The dot represents the current directory.  I&#8217;ve also highlighted the DWORD value that needs to be created if it doesn&#8217;t exist and if so, then it&#8217;s value must be set to zero (0). </p>
<p><em><strong>Get-ItemProperty .</strong></em></p>
<p><em><strong><a href="http://jkeohan.files.wordpress.com/2010/11/get-itemproperty.jpg"><img title="get-itemproperty" src="http://jkeohan.files.wordpress.com/2010/11/get-itemproperty.jpg?w=958&#038;h=301" alt="" width="958" height="301" /></a></strong></em></p>
<p>Below is the final script.   It&#8217;s simple and a rough cut, something I will fine tune in the next post.</p>
<p><a href="http://jkeohan.files.wordpress.com/2010/11/regscript.jpg"><img title="regscript" src="http://jkeohan.files.wordpress.com/2010/11/regscript.jpg?w=1024&#038;h=436" alt="" width="1024" height="436" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/835/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/835/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/835/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/835/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/835/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/835/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/835/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/835/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/835/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/835/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/835/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/835/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/835/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/835/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=835&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2010/11/29/deleting-default-shares-using-powershell-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/get-psdrive_ft_auto_wrap.jpg" medium="image">
			<media:title type="html">get-psdrive_ft_auto_wrap</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/get-psprovider_ft_auto.jpg" medium="image">
			<media:title type="html">get-psprovider_ft_auto</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/sl-hklm.jpg" medium="image">
			<media:title type="html">sl hklm</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/get-itemproperty.jpg" medium="image">
			<media:title type="html">get-itemproperty</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/regscript.jpg" medium="image">
			<media:title type="html">regscript</media:title>
		</media:content>
	</item>
		<item>
		<title>Deleting Default Shares Using Powershell &#8211; Part 1</title>
		<link>http://jkeohan.wordpress.com/2010/11/22/deleting-default-shares-using-powershell/</link>
		<comments>http://jkeohan.wordpress.com/2010/11/22/deleting-default-shares-using-powershell/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 23:39:53 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=782</guid>
		<description><![CDATA[All Windows systems have several default administrative shares configured which are immediately available after installation.  These shares not only provided direct access to the %SystemRoot%\Windows directory (Admin$) but to the root of all hard drives (C$,D$).  There is also the Inter-Process Communication (IPC$) share which is used to facilitate communication between process and computers over [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=782&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>All Windows systems have several default administrative shares configured which are immediately available after installation.  These shares not only provided direct access to the %SystemRoot%\Windows directory (Admin$) but to the root of all hard drives (C$,D$).  There is also the Inter-Process Communication (IPC$) share which is used to facilitate communication between process and computers over Server Message Blocks (SMB). The shares can be enumerated in Powershell using the Win32_Share class.</p>
<p><span id="more-782"></span></p>
<pre class="PowerShellColorizedScript"><span style="color:#0000ff;">Get-WmiObject</span> <span style="color:#8a2be2;">Win32_Share</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Format-Table</span> <span style="color:#000080;">-AutoSize</span></pre>
<p><a href="http://jkeohan.files.wordpress.com/2010/11/1jpg.jpg"><img title="1jpg" src="http://jkeohan.files.wordpress.com/2010/11/1jpg.jpg?w=959&#038;h=128" alt="" width="959" height="128" /></a></p>
<p>I&#8217;ve used the Format-Table cmdlet with the –Autosize parameter to automatically adjust the column size based on the width of the data.  Otherwise it would look something like this.</p>
<p><a href="http://jkeohan.files.wordpress.com/2010/11/2.jpg"><img title="2" src="http://jkeohan.files.wordpress.com/2010/11/2.jpg?w=954&#038;h=123" alt="" width="954" height="123" /></a></p>
<p>The machine I&#8217;m working with has several partitions, all of which are being shared, and although they are hidden ($) which means they will not be enumerated over the network by remote machines via My Network Places (XP) or Network (Vista\7), they are just as accessible as any other share I would have manually made available.  This doesn&#8217;t mean just anyone has permissions to access them as they are being protected by NTFS\Share permissions as well as the Windows Firewall.   This does mean that if one machine&#8217;s adminstrator account is compromised then it&#8217;s possible that all machines are vulnerable.  Best security practices state that all unneeded services, shares, etc be disabled\turned off to prevent such attacks.    That being the case I&#8217;ve decided to write a script that will  remove only the administrative disk shares and then keep them turned off. </p>
<p>In order to do this I needed first to determine what property value is used to distinguish an administrative disk share from one manually created. I decided to select the first available share ($Admin) and then view all available membertypes, which will include Methods, Properties, PropertySets and ScriptMethods. </p>
<pre class="PowerShellColorizedScript"><span style="color:#0000ff;">Get-WmiObject</span> <span style="color:#8a2be2;">Win32_Share</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select-Object</span> <span style="color:#000080;">-First</span> <span style="color:#800080;">1</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Get-Member</span></pre>
<p><em><img title="3" src="http://jkeohan.files.wordpress.com/2010/11/3.jpg?w=960&#038;h=410" alt="" width="960" height="410" /></em></p>
<p>Another way to view the membertypes of a specific object (in this case the Admin$ share)  is to use a Where-Object match expression and then to pipe the results to Get-Member to filter for properties only.</p>
<pre class="PowerShellColorizedScript"><span style="color:#ff4500;">$Obj</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">Get-WmiObject</span> <span style="color:#8a2be2;">Win32_Share</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Where-Object</span> <span style="color:#000000;">{</span> <span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Name</span> <span style="color:#a9a9a9;">-eq</span> <span style="color:#8b0000;">"Admin$"</span> <span style="color:#000000;">}</span>
<span style="color:#ff4500;">$Obj</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Get-Member</span> <span style="color:#000080;">-MemberType</span> <span style="color:#8a2be2;">Property</span></pre>
<p><em><strong><img title="4" src="http://jkeohan.files.wordpress.com/2010/11/4.jpg?w=960&#038;h=340" alt="" width="960" height="340" /></strong></em></p>
<p>All shares are classified based on a &#8220;Type&#8221; property.    The below chart is used to categorize all possible shares and shared devices. </p>
<ul style="margin-left:39pt;">
<li>1    Print Share</li>
<li>2    Device Share</li>
<li>3    IPC Share</li>
<li>2147483648    Administrative Disk Share</li>
<li>2147483649    Administrative Print Share</li>
<li>2147483650     Administrative Device Share</li>
<li>2147483651    Administrative IPC Share</li>
</ul>
<p>In order to verify the value assigned to the Admin$ share we could use either of the following.</p>
<pre class="PowerShellColorizedScript"><span style="color:#0000ff;">Get-WmiObject</span> <span style="color:#8a2be2;">Win32_Share</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">?</span> <span style="color:#000000;">{</span><span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Name</span> <span style="color:#a9a9a9;">-eq</span> <span style="color:#8b0000;">"Admin$"</span><span style="color:#000000;">}</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Select</span> <span style="color:#8a2be2;">Name</span><span style="color:#a9a9a9;">,</span><span style="color:#8a2be2;">Type</span> <span style="color:#a9a9a9;">|</span>
<span style="color:#0000ff;">Format-Table</span> <span style="color:#000080;">-AutoSize</span>            

<span style="color:#000000;">(</span><span style="color:#0000ff;">Get-WmiObject</span> <span style="color:#8a2be2;">Win32_Share</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Where-Object</span> <span style="color:#000000;">{</span><span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Name</span> <span style="color:#a9a9a9;">-eq</span> <span style="color:#8b0000;">"Admin$"</span><span style="color:#000000;">}</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Type</span></pre>
<p>Just to keep things simple I&#8217;ve decided to use the second example which is more specific</p>
<p><a href="http://jkeohan.files.wordpress.com/2010/11/7.jpg"><img title="7" src="http://jkeohan.files.wordpress.com/2010/11/7.jpg?w=959&#038;h=36" alt="" width="959" height="36" /></a></p>
<p>Now that I&#8217;ve confirmed the value of the Admin$ disk share I can create a filter to look for all administrative disk shares (those ending with 48), assign the results to a variable ($Share), use the Foreach construct to loop through all elements in the associative array and then invoke the Delete method to remove them.  </p>
<pre class="PowerShellColorizedScript"><span style="color:#ff4500;">$Share</span> <span style="color:#a9a9a9;">=</span> <span style="color:#0000ff;">Get-WmiObject</span> <span style="color:#8a2be2;">Win32_Share</span> <span style="color:#a9a9a9;">|</span> <span style="color:#0000ff;">Where-Object</span> <span style="color:#000000;">{</span> <span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Type</span> <span style="color:#a9a9a9;">-like</span> <span style="color:#8b0000;">"*48*"</span> <span style="color:#000000;">}</span>
<span style="color:#00008b;">Foreach</span> <span style="color:#000000;">(</span> <span style="color:#ff4500;">$i</span> <span style="color:#00008b;">in</span> <span style="color:#ff4500;">$Share</span> <span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
    <span style="color:#ff4500;">$I</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Delete</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>
    <span style="color:#000000;">}</span></pre>
<p>Although this accomplishes the task at hand it&#8217;s only temporary.  When the machine is rebooted the Server service will reshare all of them once again.  In order to prevent this the registry needs to edited to include a new DWORD, something I will demo in the next artictle</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/782/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/782/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/782/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=782&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2010/11/22/deleting-default-shares-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/1jpg.jpg" medium="image">
			<media:title type="html">1jpg</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/2.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/3.jpg" medium="image">
			<media:title type="html">3</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/4.jpg" medium="image">
			<media:title type="html">4</media:title>
		</media:content>

		<media:content url="http://jkeohan.files.wordpress.com/2010/11/7.jpg" medium="image">
			<media:title type="html">7</media:title>
		</media:content>
	</item>
		<item>
		<title>Penetration Testing with Backtrack &#8211; Overview</title>
		<link>http://jkeohan.wordpress.com/2010/07/14/penetration-testing-with-backtrack/</link>
		<comments>http://jkeohan.wordpress.com/2010/07/14/penetration-testing-with-backtrack/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 14:31:23 +0000</pubDate>
		<dc:creator>joeroc</dc:creator>
				<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://jkeohan.wordpress.com/?p=757</guid>
		<description><![CDATA[I recently signed up for an online hacking class offered by Offensive-Security.com called PWB (Penetration Testing with Backtrack).    The subsequent exam  &#8220;Offensive Security Certified Professional&#8221; (OSCP), will provide a solid baseline for demonstrating my knowledge on pentesting using BackTrack, which is a popular and free Linux based hacking distro. Below is the a full description of the OSCP certification: The Offensive [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=757&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently signed up for an online hacking class offered by <a href="http://www.offensive-security.com/">Offensive-Security.com</a> called <a href="http://www.offensive-security.com/online-information-security-training/penetration-testing-backtrack/">PWB (Penetration Testing with Backtrack). </a>   The subsequent exam  <strong>&#8220;Offensive Security Certified Professional&#8221; (OSCP), </strong>will provide a solid baseline for demonstrating my knowledge on pentesting using BackTrack, which is a popular and free Linux based hacking distro. Below is the a full description of the OSCP certification:</p>
<p><a title="Information Security Certifications" href="http://www.offensive-security.com/information-security-certifications/">The Offensive Security Certified Professional</a> (OSCP) is a unique and industry leading IT Security Certification that tests real world skills in the penetration testing field. No multiple choice questions, no theoretical fluff – The student will be expected to dive into an unknown network, craft custom tailored exploits, find security flaws, and exploit weaknesses within the architecture in order to pass the certification process. Students who successfully complete the Offensive Security PWB Penetration Testing Training certification challenge receive the OSCP certification. Penetration Testing with BackTrack simulates a full penetration test from start to finish by injecting the student into a rich, diverse and vulnerable network environment. Pre-Requisites</p>
<p>The online class consists of a series of downloaded videos, lab book, lab guide(PDF), sample Pentest Report and an online lab environment that includes clients and servers divided into 4 networks.   I also opted to download a customized version of Backtrack for VMWare to use during the labs.  I have 30 days to work through the material, document my findings and then 24hrs to complete the certification challenge.   I will post my progress and challenges as I progess through the course.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jkeohan.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jkeohan.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jkeohan.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jkeohan.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jkeohan.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jkeohan.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jkeohan.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jkeohan.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jkeohan.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jkeohan.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jkeohan.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jkeohan.wordpress.com/757/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jkeohan.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jkeohan.wordpress.com/757/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jkeohan.wordpress.com&amp;blog=3947612&amp;post=757&amp;subd=jkeohan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jkeohan.wordpress.com/2010/07/14/penetration-testing-with-backtrack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d25217ac2c0ce22997d8490eeecd8f41?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">joeroc</media:title>
		</media:content>
	</item>
	</channel>
</rss>
