Update (2011-07-14): Please find a blog post on MPElementsExtract story and use cases here or here.

How to run

  1. Start command prompt
  2. Run MPElementsExtract .exe using following syntax:

MPElementsExtract.exe <MP.xml> </em[bed]|/ex[tract]|/p[utplacemarks]> [/destination:<directory>]

Where:

<MP.xml>

Path to unsealed management pack file (can be relative)

Mode

  • /ex or /extract - extract all embedded content and places it into destination folder (see output structure description below)
  • /p or /putplacemarks - same as /ex, additionally some content will be replaced with "place marks" and modified version of a management pack will be saved into destination folder
  • /em or /embed - embed content (stored side-by-side )into management pack

Destination

/destination:<directory> - Destination folder where output should be placed to. Must exist.

Output

Output will always have following structure:

  • <MP ID> (folder)
    • DWScripts (folder) - /ex only
      • *.sql
    • DWSubScripts (folder) - /ex or /p
      • Some folders - depends on names of subscripts
      • *.sql
    • LinkedReports (folder) - /ex or /p
      • *.rpdl
      • *.parameters
    • ReportResources (folder) - /ex or /p
      • *.*
    • Reports (folder) - /ex or /p
      • *.rdl
      • *.rpdl
    • Scripts (folder) - /ex only
      • *.vbs
      • *.js
    • SubScripts (folder) - /ex or /p
      • Some folders - depends on names of subscripts
      • *.vbs
      • *.js
    • <MP.xml> - /p or /em

 

By default the output will be placed in the same directory where source MP is stored. This can be changed using /destination option

Subscripts

Every script's body may be combined with one ore more parts - subscripts. Subscript should be started with the following header:

For vbs:

' ##### <MySubScriptName.vbs>

For js:

// ##### <MySubScriptName.js>

For sql:

-- ##### <MySubScriptName.sql>

Notes:

  • If first line of the script doesn't contain a subscript name, script name will be used. Leading blank lines will be omitted.
  • Subscript content is respected. If there is a subscript with the same name, but with different content, another (numerated) file will be created.
  • Subscript's name may contain path. Path is considered to be relative to corresponding output directory. If path is absolute, disk letter is considered as a first directory. For example, for following names

MP Name = My.MP.xml

Subscript name = C:\MyScript\Common\wmi.vbs

 You'll get following folders and files:

  • My.MP
    • SubScripts
      • C
        • MyScript
          • Common
            • Wmi.vbs

Place marks

Place mark is a string that is used to specify the exact place where specific content should be embedded. Content itself is stored side-by-side with MP being developed. Place mark looks as follows:

{{<MyScriptName.vbs>}}

Where

MyScriptName.vbs - path and name of a subscript. Path should be relative to location of the management pack file.

Subscript may be referenced several times. Subscript may be references from several management packs.

Note: place marks are used only for SubScripts and DWScripts. IDs are used for other types of content (reports, report resources, etc.).

Last edited Sep 21, 2011 at 8:51 PM by olegkapustin, version 7

Comments

No comments yet.