Log in  \/ 
Register  \/ 


About the type of the parameter of the Powershell script in the Service Manager Authoring Tool

Hi friends,

In my previous post I’ve described in detail what type of the parameter SCSM2012 Authoring Tool automatically assigns for the Powershell script’s parameter if this parameter is GUID (in that post it was ID of Service Request). And I mentioned that we needed to control the script’s text in XML file. That is definitely awkward and one of my colleagues has prompted me how to avoid that.

If you use the Authoring Tool and GUID as a parameter in your Powershell script you can change a syntax of the script and avoid manual editing of the XML files. For instance, if we use R_GUID as a parameter of GUID type and have such a string in the script:

$reviewer = Get-SCSMObject -Id $R_GUID.ToString()

we can use another syntax with the same result:

$reviewer = Get-SCSMObject -Id ([guid]$R_GUID).ToString()

Compare these two variants

# source code

# The string below was automatically generated by the Authoring Tool and then we edited it manually

param ( [guid]$R_GUID )

# our source code



# final code

# The string below was automatically generated by the Authoring Tool

param ( [string]$R_GUID )

# our final code

$reviewer=Get-SCSMObject-Id ([guid]$R_GUID).ToString()

Categories: System Center 2012 Service Manager

Marat Kuanyshev

Comments (1)

  • Marat Kuanyshev

    Marat Kuanyshev

    25 September 2013 at 16:02 |
    If you take a look in XML code of the management pack built by Authoring Tool you'll notice that using my approach the script does many casting: [guid] to [string], then [string] to [guid], then [guid] to [string]. The last version of AT for SCSM 2012 SP1 works correct with types so now you can safely use a simple syntax like "$reviewer = Get-SCSMObject -Id R_GUID".


Leave a comment

You are commenting as guest.

This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.