Storage Informer
Storage Informer

Synchronous Connections

by on Jun.02, 2009, under Storage

Intel AMT DTK: Synchronous Connections

Hello vPro Experts,

In case you&aposve worked with any of the Powershell code samples I&aposve previously posted, you&aposve probably noticed that the AmtSystem.Connect() method executes asynchronously, and returns immediately. In this case, you&aposd 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:while ($amtdevice.State -eq "Connecting") { Start-Sleep 1 }But that&aposs ugly, because, what happens if it never connects? Although it&aposs 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 ManageabilityStack .NET assembly in the Intel AMT Developer Toolkit (DTK) to allow synchronous connections to AMT from PowerShell code.In order to perform the next steps, you&aposll need the following:The Intel AMT DTK source codeMicrosoft Visual Studio 2008 (the Express edition is fully functional and free!)Microsoft Windows PowerShell 1.0 or 2.0 CTP3Once you&aposve installed these components, continue on:Download the Intel AMT DTK source code and extract to a folderNavigate to Source\Manageability Stack and open the Manageability Stack.csproj file in Visual Studio 2008Open the AmtSystem.cs file in the Visual Studio Solution ExplorerRename the Connect() method to ConnectAsync()Copy the following code above the ConnectAsync() method:public void Connect(){In the Visual Studio Solution Explorer, right-click the Manageability Stack project, and click BuildGo to your Source\Manageability Stack\obj\Debug folder, and grab your new ManageabilityStack.dll .NET assemblyNow that you have a recompiled ManageabilityStack assembly, you can load this into PowerShell, and connect synchronously using the Connect() method! Update: I attached the AmtSystem.cs file to this blog post, if you&aposre not comfortable modifying source code yourself! You&aposll still need to replace the file, open the project, and recompile the library though Trevor SullivanSystems EngineerOfficeMax Corporation


:, , , , , , , ,

Leave a Reply

Powered by WP Hashcash

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...