Tagged: SUB

SCCM Console Extensions – Parameters

OK, so now you know the GUID for the right-click tool… but what about passing parameters?

There are a few standard SUB’s (parameters) that you can use, some are listed in this post: http://www.snowland.se/2008/05/28/sccm-console-extensions/

But if you take the example of GUID 5fb29b42-5d11-4642-a6c9-24881a7d317e that you can find under Software Distribution Packages / Packages / Some package / Package Status / Site Server / Right click on a distribution point

Say that you want to pass the server-name or the path to the package…

First off, open the E:\Program Files\Microsoft Configuration Manager\AdminUI\XmlStorage\ConsoleRoot\AdminConsole.xml in some editor.

Then search for the GUID and you will find something like this.

<NodeDescriptions>
  <ResultPaneItemDescriptions>
    <ResultPaneItemDescription NamespaceGuid="5fb29b42-5d11-4642-a6c9-24881a7d317e" DesignerName="Localize:Status scoped result panel definitioN">
      <Queries>
        <QueryDescription NamespaceGuid="54d25192-0e7a-47b2-a6f2-67ff764d41c6" Type="WQL" HelpTopic="e63a41d2-a2c2-4a52-bfbb-67dc0bd7b429">
          <SupportedTypes>
            <string>SMS_PackageStatusDetailSummarizer</string>
          </SupportedTypes>
          <Query>SELECT * FROM SMS_PackageStatusDistPointsSummarizer WHERE PackageID='##SUB:PackageID##' AND SiteCode='##SUB:SiteCode##'</Query>
          <ReturnedClassType>SMS_PackageStatusDistPointsSummarizer</ReturnedClassType>
        </QueryDescription>
      </Queries>
    </ResultPaneItemDescription>
  </ResultPaneItemDescriptions>
</NodeDescriptions>

A few lines below the GUID you find SELECT * FROM SMS_PackageStatusDistPointsSummarizer WHERE Packa… Copy that line and replace/clean it up so that it is a valid WMI-query.
Will look something like:

SELECT * FROM SMS_PackageStatusDistPointsSummarizer WHERE PackageID='XYZ00123' AND SiteCode='XYZ'

Next step is to start some WMI-browser and connect to root\SMS\site_XYZ and run the query and take a look at the columns.
(I like to use WMI Explorer)

In the query above you will have columns like ServerNALPath, SourceNALPath, SourceVersion this is what you are looking for. 🙂

Use them in your extensions like this:

<Executable>
	<FilePath>myScript.vbs</FilePath>
	<Parameters>##SUB:ServerNALPath## ##SUB:SourceNALPath## ##SUB:SourceVersion##</Parameters>
</Executable>
http://www.pasta-recipes.com

SCCM Console Extensions

Some small notes and short (but powerful) example about SCCM Console Extensions…

Some good-to-have GUIDs
You find them all in adminconsole.xml

  • fa922e1a-6add-477f-b70e-9a164f3b11a2 – First-level collections
  • dbb315c3-1d8b-4e6a-a7b1-db8246890f59 – Subcollections
  • 7ba8bf44-2344-4035-bdb4-16630291dcf6 – Resource in collection
  • de41d5d8-3845-4e67-9657-0121f06f5e27 – Programs
  • a1ad0705-ce2d-4981-96f5-8f0faad47396 – Advertisments
  • 49696c48-9c3a-4d4a-bb38-473394700d43 – Site Systems

Some of the SUBs
You find them all in adminconsole.xml

  • ##SUB:__Server##
  • ##SUB:__Namespace##
  • ##SUB:Name##
  • ##SUB:PackageID##
  • ##SUB:ProgramName##
  • ##SUB:SiteCode##
  • ##SUB:SiteName##
  • ##SUB:NetworkOSPath##
  • ##SUB:AddressType##
  • ##SUB:Order##
  • ##SUB:value##
  • ##SUB:ItemName##

Example XML-file:
(Put it to “SCCM\AdminUI\XmlStorage\Extensions\Actions\fa922e1a-6add-477f-b70e-9a164f3b11a2\sccmExtensions.xml”)

<ActionDescription Class="Executable" DisplayName="Show Params" MnemonicDisplayName="Show Params" Description = "Show Params">
	<Executable> 
		<FilePath>C:\sccmExtenstions.vbs</FilePath>
		<Parameters>##SUB:__Server## ##SUB:__Namespace## ##SUB:Name## ##SUB:PackageID## ##SUB:ProgramName## ##SUB:SiteCode## ##SUB:SiteName## ##SUB:NetworkOSPath## ##SUB:AddressType## ##SUB:Order## ##SUB:value## ##SUB:ItemName##</Parameters>
	</Executable>
</ActionDescription>

And the script to use
(Put this into C:\sccmExtensions.vbs)

sOut = ""
For i = 0 to WScript.Arguments.Count-1
	sOut = sOut & "Arg " & i+1 & " : " & Wscript.Arguments(i) & vbCrLf
Next
MsgBox sOut

Then, try to right-click a first level collection and select “Show Params”…

Tip
Greg Ramsy’s Console Extensions GUID Locator
www.google.com 😉

Happy scripting! 🙂