Get the SCSM View ElementID from MP with PowerShell

I had the need to get the View ElementID without opening the MP file. This is the simple PowerShell script to do this.

Just save the code to a .ps1 file and run it with the MP Filename and the Name of the View as parameters.
 

Param
(
     [Parameter(Mandatory=$True)]
     [String]$File,
     [Parameter(Mandatory=$True)]
     [String]$Name
)
Process
{
     $xml=Get-Content"$File"$in=$xml.SelectNodes("//DisplayString")
     foreach($iin$in)
     {
         if($i.Name -eq"$Name")
         {
             $i
         }
     }
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.