<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/clearspace/rss" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Intel vPro Expert Center Blog</title>
    <link>http://communities.intel.com/community/openportit/vproexpert/blog</link>
    <description>Intel vPro Expert Center Blog</description>
    <pubDate>Thu, 16 Apr 2009 13:36:01 GMT</pubDate>
    <generator>Clearspace 2.5.9 (http://jivesoftware.com/products/clearspace/)</generator>
    <dc:date>2009-04-16T13:36:01Z</dc:date>
    <item>
      <title>Intel AMT DTK: Synchronous Connections</title>
      <link>http://communities.intel.com/community/openportit/vproexpert/blog/2009/06/02/intel-amt-dtk-synchronous-connections</link>
      <description>&lt;!-- [DocumentBodyStart:f3ed3ef4-78fb-405e-a529-ff7083a27199] --&gt;&lt;div class='jive-rendered-content'&gt;&lt;p&gt;Hello vPro Experts,&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In case you've worked with any of the Powershell code samples I've previously posted, you've probably noticed that the &lt;span style="color: #008080;"&gt;&lt;em&gt;AmtSystem.Connect()&lt;/em&gt;&lt;/span&gt; method executes asynchronously, and returns immediately. In this case, you'd have to develop some sort of loop in order to determine whether or not the connection was successful. Typically, I would just use this code to prevent a script from continuing before the connection was established:&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #008080;"&gt;&lt;span style="font-family: courier new, courier;"&gt;while ($amtdevice.State -eq "Connecting") { Start-Sleep 1 }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;But that's ugly, because, what happens if it never connects? Although it's nice to have the ability to asychronously connect to AMT devices, writing code and understanding the logic, to handle async processes is significantly more difficult than writing code that is synchronous. For this reason, we will look at how to modify and recompile the &lt;em&gt;ManageabilityStack&lt;/em&gt; .NET assembly in the Intel AMT Developer Toolkit (DTK) to allow synchronous connections to AMT from PowerShell code.&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In order to perform the next steps, you'll need the following:&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The &lt;a class="jive-link-external-small" href="http://software.intel.com/en-us/articles/download-the-latest-version-of-manageability-developer-tool-kit/"&gt;Intel AMT DTK source code&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a class="jive-link-external-small" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&amp;amp;displaylang=en"&gt;Microsoft Visual Studio 2008&lt;/a&gt; (the Express edition is &lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;fully functional and free&lt;/strong&gt;&lt;/span&gt;!)&lt;/li&gt;&lt;li&gt;Microsoft Windows &lt;a class="jive-link-external-small" href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx"&gt;PowerShell 1.0&lt;/a&gt; or &lt;a class="jive-link-external-small" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c913aeab-d7b4-4bb1-a958-ee6d7fe307bc"&gt;2.0 CTP3&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Once you've installed these components, continue on:&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;ol start="1"&gt;&lt;li&gt;Download the Intel AMT DTK source code and extract to a folder&lt;/li&gt;&lt;li&gt;Navigate to &lt;span style="color: #008080;"&gt;&lt;em&gt;&amp;lt;Source&amp;gt;\Manageability Stack&lt;/em&gt;&lt;/span&gt; and open the &lt;em&gt;&lt;span style="color: #008080;"&gt;Manageability Stack.csproj&lt;/span&gt;&lt;/em&gt; file in Visual Studio 2008&lt;/li&gt;&lt;li&gt;Open the &lt;em&gt;AmtSystem.cs&lt;/em&gt; file in the Visual Studio Solution Explorer&lt;/li&gt;&lt;li&gt;Rename the &lt;em&gt;Connect()&lt;/em&gt; method to &lt;em&gt;ConnectAsync&lt;/em&gt;()&lt;/li&gt;&lt;li&gt;Copy the following code above the ConnectAsync() method:&lt;br/&gt;&lt;span style="color: #0000ff;"&gt;public void Connect()&lt;br/&gt;{&lt;br/&gt;   if (State != AmtSystemObjState.Disconnected) return;&lt;br/&gt;   ChangeState(AmtSystemObjState.Connecting);&lt;br/&gt;   ConnectEx(this);&lt;br/&gt;}&lt;/span&gt;&lt;/li&gt;&lt;li&gt;In the Visual Studio Solution Explorer, right-click the Manageability Stack project, and click Build&lt;/li&gt;&lt;li&gt;Go to your &lt;span style="color: #008080;"&gt;&lt;em&gt;&amp;lt;Source&amp;gt;\Manageability Stack\obj\Debug&lt;/em&gt;&lt;/span&gt; folder, and grab your new &lt;em&gt;&lt;span style="color: #008080;"&gt;ManageabilityStack.dll&lt;/span&gt;&lt;/em&gt; .NET assembly&lt;/li&gt;&lt;/ol&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now that you have a recompiled &lt;em&gt;ManageabilityStack&lt;/em&gt; assembly, you can load this into PowerShell, and connect &lt;span style="text-decoration: underline;"&gt;synchronously&lt;/span&gt; using the &lt;em&gt;Connect&lt;/em&gt;() method! &lt;img height="16px" src="http://communities.intel.com/images/emoticons/happy.gif" width="16px"/&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration: underline;"&gt;Update&lt;/span&gt;&lt;/strong&gt;: I attached the &lt;em&gt;AmtSystem.cs&lt;/em&gt; file to this blog post, if you're not comfortable modifying source code yourself! You'll still need to replace the file, open the project, and recompile the library though &lt;img height="16px" src="http://communities.intel.com/images/emoticons/happy.gif" width="16px"/&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Trevor Sullivan&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Systems Engineer&lt;/em&gt;&lt;/p&gt;&lt;p&gt;OfficeMax Corporation&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:f3ed3ef4-78fb-405e-a529-ff7083a27199] --&gt;</description>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">programming</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">automation</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">vpro</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">administer</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">code</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">developer</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">visual</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">dtk</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">administration</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">amt</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">microsoft</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">studio</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">c#</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">coding</category>
      <category domain="http://communities.intel.com/community/openportit/vproexpert/blog/tags">.net</category>
      <pubDate>Tue, 02 Jun 2009 20:17:27 GMT</pubDate>
      <author>pcgeek86@gmail.com</author>
      <guid>http://communities.intel.com/community/openportit/vproexpert/blog/2009/06/02/intel-amt-dtk-synchronous-connections</guid>
      <dc:date>2009-06-02T20:17:27Z</dc:date>
      <clearspace:dateToText>7 months, 2 weeks ago</clearspace:dateToText>
      <wfw:comment>http://communities.intel.com/community/openportit/vproexpert/blog/comment/intel-amt-dtk-synchronous-connections</wfw:comment>
      <wfw:commentRss>http://communities.intel.com/community/openportit/vproexpert/blog/feeds/comments?blogPost=12066</wfw:commentRss>
    </item>
  </channel>
</rss>

