Step 9 - Edit and Build Automation Application

Published: December 23, 2009

Applies To: Windows Server 2008, Windows Server 2008 R2

In this step, you will be replacing the GUIDs that are currently in the appendix code with the GUID from the management agents you created. Then you will compile the application.

Existing Management Agent GUIDs

Management Agent Name GUID

ACCOUNT

3FB465E8-319F-42BC-ADEF-2A6B83BF358F

RESOURCE

78D3CE93-811A-4779-8057-3553EDAD3A89

SQL

3509863F-647E-487A-86D6-62EF434AD60D

The following steps show how to edit and build the automation application.

  1. Log on to RES-DC.resource.fabrikam.net as Administrator

  2. Click Start, click All Programs, click Microsoft Visual Studio 2008, and click Microsoft Visual Studio 2008. This will open Microsoft Visual Studio 2008.

  3. In Microsoft Visual Studio 2008, go to the top and select File, select New, and select Project. This will bring up the New Project window.

  4. On the New Project screen, on the left under Project types:, select Visual C# and then under Templates: select Console Application.

  5. On the New Project screen, under Name: enter Automator.

  6. On the New Project screen, leave the defaults for Location: and Solution Name: and click OK. This will bring up the Automator in Visual Studio.

  7. Delete all of the code that appears in the large window on the left. Copy the code from Appendix E – Automator application.

  8. On the right, under Solution Explorer, right-click Automator and select Add Reference. This will bring up the Add Reference dialog box.

  9. On the Add Reference dialog box, click the .NET tab and select System.Management from the list and click OK.

  10. On the right, under Solution Explorer, right-click Automator and select Add Reference. This will bring up the Add Reference dialog box.

  11. On the Add Reference dialog box, click the Browse tab navigate to C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0 select System.Management.Automation and click OK.

  12. At the top, select Edit, select Find and Replace, and select Quick Replace. This will bring up the Find and Replace dialog box.

  13. On the Find and Replace dialog box, under Find what: enter the GUID of the ACCOUNT management agent from the table above - 3FB465E8-319F-42BC-ADEF-2A6B83BF358F.

  14. On the Find and Replace dialog box, under Replace with: enter the GUID for your ACCOUNT management agent.

  15. On the Find and Replace dialog box, click Replace All. This should complete with the message 5 occurrence(s) replaced. Click OK.

    noteNote
    Repeat the above process for each management agent. There should be 5 occurrences for the RESOURCE management agent and 4 occurrences for the SQL management agent.

  16. Close the Find and Replace dialog box.

  17. In Visual Studio, at the top, select Build and then select Build Solution. Down at the bottom, in the Output section, you should see Build: 1 succeeded or up-to-date, 0 failed, 0 skipped. Close Visual Studio.

  18. Click Start, click Computer, and then double-click Local Disk (C:), double-click Users, double-click Administrator, double-click Documents, double-click Visual Studio 2008, double-click Projects, double-click Automator, double-click Automator, double-click bin, double-click Debug. Copy the Automator application to the Operations folder.

Community Additions

ADD
Show: