So, one of the consultants in the company I work at came to me with a strange request.

The request from the customer he was helping was the following. They wanted a way to connect to all the switches within their environment and then run some commands against the switch after connecting to the switch on port 23. Once the connection has been made, then some commands are run to get the current running configuration. Then export this to a text file.

So I found a basic script here. I have since taken this and modified and extended the script. I have added an array for the IPs to be checked. I have also added some checking prior to running any commands. I have added some testing.

First, we test the connection and see if the device is responding to pings. If the device is responding to pings, then test and see if the device is configured for telnet. So basically I am looking to see if port 23 is open. If port 23 is not opened, a log file is updated with the IP Address. If the device is not responding to pings, a log file is updated stating the IP of the “non-responding” device.

As an addition to the script, the files are then added to an e-mail which is sent to whomever you want to add. As part of the email process, a check is done and if an error is thrown, there is more information presented in the console to point you in the correct direction.


## PowerShell: Script To Telnet To Remote Hosts And Run Commands Against Them With Output To A File ##
## Overview: Useful for Telnet connections to Cisco Switches and other devices. Can add additional command strings
## Usage Examples: Add your environment specific details into the parameters below, or include when calling the script:
## ./PowerShellTelnetRemoteSession.ps1 "127.0.0.1" "23" "admin" "password" "term len 0" "en" "enablepassword" "show interface"
 
param(
    #[string] $remoteHost = "172.31.0.111", 
    #[int] $port = 23,
    [string] $username = "admin",
    [string] $password = "",
    #[string] $termlength = "term len 0", #Useful for older consoles that have line display limitations
    [string] $enable = "en", #Useful for appliances like Cisco switches that have an 'enable' command mode
    [string] $enablepassword = "",
    [string] $command1 = "show run", #You can add additional commands below here with additonal strings if you want
    [string] $command2 = " ",
    [string] $command3 = " ",
    [string] $command4 = " ",
    [string] $command5 = " ",
    [int] $commandDelay = 1000
   )
 
[string] $output = ""
 
## Read output from a remote host
function GetOutput
{
  ## Create a buffer to receive the response
  $buffer = New-Object System.Byte[] 4096
  $encoding = New-Object System.Text.AsciiEncoding
 
  $outputBuffer = ""
  $foundMore = $false
 
  ## Read all the data available from the stream, writing it to the
  ## output buffer when done.
  do
  {
    ## Allow data to buffer for a bit
    Start-Sleep -m 1000
 
    ## Read what data is available
    $foundmore = $false
    $stream.ReadTimeout = 1000
 
    do
    {
      try
      {
        $read = $stream.Read($buffer, 0, 1024)
 
        if($read -gt 0)
        {
          $foundmore = $true
          $outputBuffer += ($encoding.GetString($buffer, 0, $read))
        }
      } catch { $foundMore = $false; $read = 0 }
    } while($read -gt 0)
  } while($foundmore)
 
  $outputBuffer
}
 
function Main
{
    param ($ip,$port)
  ## Open the socket, and connect to the computer on the specified port
 
  Write-Host "Connecting to $ip on port $port"


  $socket = New-Object System.Net.Sockets.TcpClient($ip, $port)
  
 
  Write-Host "Connected. Press ^D followed by [ENTER] to exit.`n"
 
  $stream = $socket.GetStream()
 
  $writer = New-Object System.IO.StreamWriter $stream
 
    ## Receive the output that has buffered so far
    $SCRIPT:output += GetOutput
 
        $writer.WriteLine($username)
        $writer.Flush()
        Start-Sleep -m $commandDelay
                $writer.WriteLine($password)
        $writer.Flush()
        #Start-Sleep -m $commandDelay
                #$writer.WriteLine($termlength)
        #$writer.Flush()
        Start-Sleep -m $commandDelay
                $writer.WriteLine($enable)
        $writer.Flush()
        Start-Sleep -m $commandDelay
                $writer.WriteLine($enablepassword)
        $writer.Flush()
        Start-Sleep -m $commandDelay
                $writer.WriteLine($command1) #Add additional entries below here for additional 'strings' you created above
        $writer.Flush()
        Start-Sleep -m $commandDelay
                $writer.WriteLine($command2) #Add additional entries below here for additional 'strings' you created above
        $writer.Flush()
                Start-Sleep -m $commandDelay
                $writer.WriteLine($command3) #Add additional entries below here for additional 'strings' you created above
        $writer.Flush()
                Start-Sleep -m $commandDelay
                $writer.WriteLine($command4) #Add additional entries below here for additional 'strings' you created above
        $writer.Flush()
                Start-Sleep -m $commandDelay
                $writer.WriteLine($command5) #Add additional entries below here for additional 'strings' you created above
        $writer.Flush()
        Start-Sleep -m $commandDelay
        $SCRIPT:output += GetOutput
                
 
 
  ## Close the streams
  $writer.Close()
  $stream.Close()

  #building file name
  $filename = "c:\switch\$ip - " + $timestamp + ".txt"
 
  $output | Out-File $filename  #Change this to suit your environment
}

#build the list of ips to be interegated 
$ips = "192.168.1.2","169.254.2.2","192.168.1.101"

#building a file path
$timestamp = get-date -Format g | foreach {$_ -replace ":","."}

#building different file paths for different functions
$errortimestamp = Get-Date -Format o | foreach {$_ -replace ":", "."}
$errorfilename = "c:\switch\" + $timestamp + " - ERROR.txt"

#building different file paths for different functions
$blockedtimestamp = Get-Date -Format o | foreach {$_ -replace ":", "."}
$blockedfilename = "c:\switch\" + $timestamp + " - blocked.txt"

#looping through each ip in ip list
foreach ($ip in $ips)
{
    Write-host "Testing $ip"
    #test to see if device is responding to pings
	if (Test-Connection $ip -Quiet)
    {
        #creating connection on port 23
		$t = New-Object Net.Sockets.TcpClient
		$t.Connect($ip, 23)

        #if it connects, runs the required function with the ip
		if ($t.Connected)
		{
			. Main $ip "23"
		}
        #script block for device responding to ping, but port 23 is NOT open
		else
		{
			$portblocked = "Port 23 on $ip is closed , You may need to contact your IT team to open it. "
            Add-Content $blockedfilename "`n$portblocked"
		}
    }
    #script block for NO RESPONSE
	else 
	    {
    	$errorfilename = "c:\switch\" + $timestamp + " - ERROR.txt" 
        Add-Content $errorfilename "`nCould not ping $ip" 
	    }
}

#displaying information on console
Write-Host "Build file list" -NoNewline
#getting file list to be emailed
$files = Get-ChildItem C:\Switch\ | Where {-NOT $_.PSIsContainer} | foreach {$_.fullname}
#pausing script
Start-Sleep 3
Write-Host "`t" [File List Built] -ForegroundColor "Green"

Write-Host "Sending Email" -NoNewline

#building checks for sending emails

#no error

#replace as needed
$to = "<to>"
$from = "<from>"
$smtpserver = "<smtpserver>"

try
{
    Send-MailMessage -Attachments $files -to $to -from $from -Subject "Network Config backup - $timestamp" -SmtpServer $smtpserver -ErrorAction Stop
    Write-Host "`t [Email Sent]" -ForegroundColor "Green"
}
#error
catch
{
    $ErrorMessage = $_.Exception.Message
    #$ErrorMessage
    if ($ErrorMessage -ne $null)
    {
        Write-Host "`t [Unable to send Mail]" -ForegroundColor "Red"
        Write-Host "There was an error: $ErrorMessage" -ForegroundColor "Yellow"
    }
}

Start-Sleep 3
Write-Host "Removing Files" -NoNewline
$files | Remove-Item
Write-Host "`t [Files removed]" -ForegroundColor "Green"


(E-Mail me)

Follow me.

Facebook (Personal)

Twitter (Personal & System Centre)

Twitter (System Centre Focused)

I have found a great for load testing SCSM with Incidents. The script uses SMLets to generate Incidents and you can then gauge how your system would handle the load you are planning within your Production Environment.

I will not go into the detail of the script as this blog post does a great job of explaining it. SO this got me to thinking about other Load Testing you could perform. The most common Load Test is with Incidents. However, i decided that another good load test would be Service Requests. What is nice about this load test, is that it uses a Management Pack which I have included in this post. The Management Pack contains a Service Request Template with a Manual Activity added as the first Activity. This will allow you to test Service Requests and well as Activities, which would in turn, test any workflows or runbooks that you have configured.

For my environment, i have additional runbooks which are also triggered when Manual Activities are completed or when Review Activities are completed. So with this Load Test script it also test my runbooks and other workflows.

Remember, to set a different Implementer for the Manual Activity to allow the runbooks or workflows to be triggered off correctly. Remember, no Manual Activity Implementer or if the implementer has no email address, your emails will not be triggered correctly. Below, is a breakdown of the script I am using.

Script

#SMLets is needed for the script to work
Import-Module SMlets

#the number of Service requests to be created
$SRCount = 10

#the delay between attempts
$delay = 10

# Display Start Time
$StartTime = get-date
Write-Host "Started"
Write-Host $StartTime
Write-Host "-------------------`n"
Write-Host "Creating Service Request"
Write-Host "-------------------"
$i =1

while ($i -le $SRCount)
{

#Variable / Class Setup
$srClass = Get-SCSMClass -name System.WorkItem.ServiceRequest$
$srprior = Get-SCSMEnumeration -Name ServiceRequestPriorityEnum.Medium
$srurg = Get-SCSMEnumeration -Name ServiceRequestUrgencyEnum.Medium
$ararea = get-SCSMEnumeration -Name ServiceRequestAreaEnum.Other

#building your own SR Title
$title = "Fletcher Load Testing $i - " + (get-date)

#Service Request Arguements
$srargs = @{
Title = $title;
Urgency = $srurg;
Priority = $srprior;
ID = “SR{0}”;
Area = $ararea;
Description = “Created by Script”
}

#Create Service Request
New-SCSMOBject -Class $srClass -PropertyHashtable $srargs

#Get Projection &amp; Object for Created Service Request
$srTypeProjection = Get-SCSMTypeProjection -name System.WorkItem.ServiceRequestProjection$
$SRProj = Get-scsmobjectprojection -ProjectionName $srTypeProjection.Name -filter “title -eq $title”

#Get Template
$template = Get-SCSMObjectTemplate -DisplayName "Load Test SR Template"

#Set Template
Set-SCSMObjectTemplate -Projection $SRProj -Template $template
$SR = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -filter "Title -eq $title"
$SRName = $SR.name
$SRTitle = $SR.Title
Write-Host $SRName " - " $SRTitle
#$SRName

# Pause before creating next SR
Start-Sleep -s 5

#getting the above created Service Request
$ServiceRequestToUpdate = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "Id -eq $SRName"

#get the Realted Child Manual Activity
$ChildActivities = (Get-SCSMRelationshipObject -BySource $ServiceRequestToUpdate | ?{$_.RelationshipID -eq "2DA498BE-0485-B2B2-D520-6EBD1698E61B"})

$get the ID Value
$MAIDToUpdate = $ChildActivities.targetobject.values[9].value

#getting the MA Class
$Class = Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity

#getting the "Active" Status
$StatusActive = Get-SCSMEnumeration -name ActivityStatusEnum.Active

$Activity = Get-SCSMObject -Class $Class | ? {$_.ID -eq $MAIDToUpdate}

#setting MA to Active
Set-SCSMObject -SMObject $Activity -Property "Status" -Value $StatusActive

#showing current status
Write-host $MAIDToUpdate " is now " $StatusActive
$i +=1
Start-Sleep -s $delay
}

# Display End Time
Write-Host "_______________________`n"
$EndTime = get-date
Write-Host = "Finished"
Write-Host $EndTime
#End of Script
#

The script can also be downloaded from the Technet Gallery here.

(E-Mail me)

Follow me.

Facebook (Personal)

Twitter (Personal & System Centre)

Twitter (System Centre Focused)

I have previously done a post on CIreson IT Asset Management. However the people at Cireson have been very busy with new features to be added to their ITAM (IT Asset Management) tool.

Cireson Asset Management: New Feature Highlights

After recently releasing the newest version of the Asset Management app for Microsoft System Centre (Features Press Release), this post goes a little more in depth to explain some of the amazing features included in this latest release. Always striving to make life easier and more productive for those who use and implement SCSM, they put a lot of thought into the features clients asked for and updates everyone was clamouring for.

Highlighted below are a few of notable enhancements, including the Cireson full Asset Catalogue, Location to IP Awareness, Contract Management and Reporting.

The full Asset Catalogue found within the Cireson Asset Management app allows users to define standard hardware types, as well as information such as model, manufacturer, and price. With access to a comprehensive yet simple and informative page view with all the relevant information in one place, users can better manage the standardization of asset types no matter what the scale of the organization.

Location to IP Awareness is now also an incredibly exciting feature. This function tracks where hardware assets exist, and also allows for hardware to location awareness based on IP address – information which is provided by System Centre 2012 Configuration Manager. This is a great example of how Cireson works to utilize all System Centre components in order to provide the most insightful and rich experience possible.

Expanding on the extensive Contract Management capabilities of the Asset Management app, the new version boasts the ability to perform full contract management with different types of contracts that relate to various software and hardware assets under management. Support and maintenance contracts, leases, and warranties represent the main areas of contract management. Highly unique to the Cireson app is the ability to manage contract status via a built-in SLA engine, with notifications upon near breach or expiration of a contract’s end date.

In addition, the superior reporting functions of this new version allows for comprehensive reporting based on asset data from the data warehouse and cube reporting engine within Service Manager. These rich out-of-the-box reporting solutions cover contract, hardware asset, license, and software asset reports, amongst others.

image

Other enhanced capabilities of the Cireson Asset Management app now include, app metering data tracking against software asset types to understand installation vs. utilization vs. purchased count, and over 250 brand new features that make the System Centre Service Manager experience better than ever before.

For more information, videos, and overviews relating to Cireson Asset Management for System Centre, visit the app store at www.cireson.com.

(E-Mail me)

Follow me.

Facebook (Personal)

Twitter (Personal & System Centre)

Twitter (System Centre Focused)

So, let’s ay you have invested the time and gotten System Centre Orchestrator up and running in your environment and you have the product performing some day to day tasks and it is working well. However, now you want start using SCO (System Centre Orchestrator) to start performing end user focused tasks like Password Reset, add users to groups or even disabling of users or server testing as part of first line support.

All of these tasks can be completed within orchestrator, however exposing them to the end user can be a little tricky. It can be done, the “native way” of performing this within the System Centre Suite is to use System Centre Service Manager with the Service Manager Orchestrator Connector and then prompt the user for information and kick off runbooks. This particular scenario works well if you have System Centre Service Manager in place, and a future blog post will cover the idea of “adding a user to an Active Directory group” as part of a Service Request. There are a few challenges around this. Firstly, you need SCSM (System Centre Service Manager) and some time and patience to test the connectors and runbooks and to create the correct templates and ensure that Workflows with SCSM are configured correctly within SCSM. Like I have said previously, this solution works and it works well!!!

In reality though, not everyone has SCSM in place, many of my companies customers are in the progress of migrating to SCSM and these systems are still in testing or QA or UAT, whatever the case may be, they are NOT in production YET! However, these companies still want this the functionality listed above. Yes, there is a way!!!

Enter EUPSCO, the full name is End User Portal System Centre Orchestrator, and as the name suggests it creates an End User Portal for System Centre Orchestrator. This allows the IT Department to create the required runbooks, to for example, ping a server or reset a password or disable an account. This creates the “Menu”, called “Services” within the End User portal. Once this is completed, the end user can then order from this menu and get the required results without the need of having to contact the IT Department. This particular tool is very easy to install and the guide is easy to follow. The End User portal requires NO Silverlight and as such, it is compatible with most browsers. I have personally tested with the IE, Chrome, Safari and Firefox, all working without issue.

The application also reads from Active Directory, this helps with your reporting line allowing a Manager of staff members (Determined by “Manager” in Active Directory) to log requests on the behalf of his/her staff members, so now +a manager can log a request to reset the password of his/her staff member. The application also allows for approvals. So each service can have an approver, the service allows for a runbook to be triggered if an Approver’s input is needed, with mine, I simply kick off a runbook, which sends an email to the approver with a link to the End User Portal and his/her requests allowing him/her to approve or deny the request.

There are a few key variables which are passed onto the runbook to allow the automation to be easier. The How To’s on the EUPSCO page cover these nicely. This Forum Post also covers these options. Just to make it a little easier, the primary ones are as follow. (please note that these are case sensitive)

1. TargetUserId

2. ApproverUserId

3. ServiceName

This should help your organization adopt System Centre Orchestrator more easily.

A BIG thank you goes out to the People at ITQ for the System Centre Orchestrator End User Portal

(E-Mail me)

Follow me.

Facebook (Personal)

Twitter (Personal & System Centre)

Twitter (System Centre Focused)

Cireson have recently released an new enhancement to the Service Manager console called the Cireson SCSM Asset Management App. This particular application is very easy to install. To install the application into the console, it is simply a case of importing a few management packs and some XML files and DLL files. This is very easy to do and the installation instructions provided by Cireson are very simple and easy to follow as with all Cireson add-ins I have worked with in the past.

In order to get the full benefit from the Cireson SCSM Asset Management App, I would highly recommend that the Configuration Manager Connector be enabled within your environment. However, this is NOT a necessity. Within my environment as I run mine as a Lab, it is not always possible to have all the connectors enabled all the time. I was very easily able to configure my workflows (come with the Cireson SCSM Asset Management App) to work and pull in the required information.

A sample of my workflow configuration is below. The workflows and settings for the Cireson SCSM Asset Management App are found under the Administration Wunderbar and then settings as with all Cireson applications.

There are settings for both Software and Hardware Collections.

Software

image

Hardware

image

A little lower down on the Hardware tab, this is where the Configuration Manager Connector would add a tremendous amount of value as you can reference different  value to be used as a Hardware ID. So, if you had the Configuration Manager Connector enabled, you could reference a Serial Number or Asset Tag. However, it is perfectly feasable to reference Principal name.

image

Under the “Miscellaneous”  tab, is where the logging is configured, which is amazingly helpful for troubleshooting.

image

(E-Mail me)

Follow me.

Facebook (Personal)

Twitter (Personal & System Center)

 Twitter (System Center Focused)

With my previous post about importing data, I showed you how to use the built-in CSV connector to do this task and how to create the required Projection Classes. However if you are looking for a quicker more automated to achieve this, enter Cireson and their Asset Import Tool. It takes all the guess work out of the import process and handles the Projection Classes for you.

The installation of the application is easy and requires the copying a DLL file to the Service Manager Installation folder and the import of a Management Pack ( a management Pack Bundle in this case). The instructions provided with the application are very clear and concise.

As usual with the Cireson applications, the settings for the applications can be found and tweaked in the Administration | Settings. This time, this is where the License Key will need to be entered
image

So now, onto the “meat”. Let’s actually use the application and see how it works. The application works pretty much the same way as the CSV Connector. It is classified as a connector, and as such to use it, a new connector would need to be created. Connectors are found under Administration | Connectors

image

If you have any Projection or Combinations classes you would like to use the application does allow the use of this.image

For this demo, I have used the Windows Computer Class, additional information around the Projection classes can be found here, this will allow to see the information (headers) used by the required class. The Windows Computer class has the following information.

Name Type MinLength MaxLength AutoIncrement

PrincipalName

string

0

256

FALSE

DNSName

string

0

256

FALSE

NetbiosComputerName

string

0

256

FALSE

NetbiosDomainName

string

0

256

FALSE

IPAddress

string

0

256

FALSE

NetworkName

string

0

256

FALSE

ActiveDirectoryObjectSid

string

0

256

FALSE

IsVirtualMachine

string

0

256

FALSE

DomainDnsName

string

0

256

FALSE

OrganizationalUnit

string

0

256

FALSE

ForestDnsName

string

0

256

FALSE

ActiveDirectorySite

string

0

256

FALSE

OffsetInMinuteFromGreenwichTime

int (range: [-2147483648, 2147483647])

0

256

FALSE

LastInventoryDate

datetime

0

256

FALSE

ObjectStatus

enum:System.

ConfigItem.ObjectStatusEnum

0

256

FALSE

AssetStatus

enum:System.

ConfigItem.AssetStatusEnum

0

256

FALSE

Notes

richtext

0 4000

FALSE

DisplayName

string

0

256

FALSE

So, for this, I will bulk import a few computers with only a few simple parameters.

I am simply adding two machines

 image

The Asset Import Tool also allows you to test your configuration first.

image

Now we can map the Headers to the Projections, you will see I kept them the same, however if you are getting a file from the IT Department or any other department, this step here allows to map these correctly.image

Next, you can set your frequency, allowing you to automate the import. I have configured mine to run Every Hour.

image

Then you can create the connector.

Final Connector completed.

image

Now lets run it!!!!

image

Since we enabled the option to “Test”, the results were written to a log file allowing us to test before running in a production environment.

image

All looks good, let’s run it to bring in the data. A simple change needs to be made. We just need to remove a checkbox.

image

Ok, change made. let’s import the data. So now, let’s re-run the import process.The Connector has now re-run, now we can check the data. This time without the testing.

image

Now, we can see the new imported data. We can check here under Configuration Items | Computers | All Windows Computers

image

And there we have it, importing nice and easy.

(E-Mail me)

Follow me.

Facebook (Personal)

Twitter (Personal & System Center)

 Twitter (System Center Focused)

So, just recently I was asked by a customer to import data from an “old” SCSM system. The customer is moving to new hardware within the organization and is using this opportunity to clean up Service Manager and re-import only clean data.

So, the challenge is the following.

The customer wants to import Change Requests from the “old” Service Manager to the “new” Service Manager. Ok, so after some research and confirmation, it is NOT possible to simply move data from one Service Manager installation to another. I decided the best way to handle this would be to import the data using a CSV file. As a start I used the following links

http://www.netiviaconsulting.com/2012/05/04/importing-work-items-in-bulk-into-scsm2012-via-csv-import-connector/

http://blogs.technet.com/b/servicemanager/archive/2009/05/26/using-the-csv-import-feature.aspx

So, now onto the “meat” of the work, it is entirely up to you what data you would like to import.

Below is a sample of my XML file. It caters for the basic information on the Change Request form and for my customers needs, it caters for SIX Manual Activities and ONE Review Activity. I will break this down into smaller pieces in a moment.

The Appendix “A” here is key to the import process.

XML Code

<CSVImportFormat>
<Projection Type="System.WorkItem.ChangeRequestProjection">
<Seed>
<Class Type="System.WorkItem.ChangeRequest">
<Property ID="Id"/>
<Property ID="Notes"/>
<Property ID="Title"/>
<Property ID="Description"/>
<Property ID="ContactMethod"/>
<Property ID="Priority"/>
<Property ID="Impact"/>
<Property ID="Risk"/>
<Property ID="Reason"/>
</Class>
</Seed>
<Component Alias="CreatedBy">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ReviewActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>
</Projection>
</CSVImportFormat>
<code>


Okay, so now time to break it down into smaller easier to manage bits.

Base Change Request Projection Class. This is the framework for Change Request and this example included the “Created By” extension. All the property id’s can be found in the appendix here. Please note that the example below does NOT include the “Projection” closing XML Brace as this is included further down with the original coding.

XML Code

</pre>
<code></code>

<Projection Type="System.WorkItem.ChangeRequestProjection">
<Seed>
<Class Type="System.WorkItem.ChangeRequest">
<Property ID="Id"/>
<Property ID="Notes"/>
<Property ID="Title"/>
<Property ID="Description"/>
<Property ID="ContactMethod"/>
<Property ID="Priority"/>
<Property ID="Impact"/>
<Property ID="Risk"/>
<Property ID="Reason"/>
</Class>
</Seed>
<Component Alias="CreatedBy">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>

<code>

So, now after this I have simply “bolted” on as many Manual Activities as I needed for my customer. In this case, it is SEVEN. I have a sample of the XML code below which can be simply copied and pasted as many times as needed. Please note that the example below does NOT include the “Projection” closing XML Brace as this is included further down with the original coding.

XML Code

</pre>
<code></code>

<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ManualActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>

<code>

And now I needed to add a Review Activity, again this is just the simple information needed.

XML Code

</pre>
<code></code>

<Component Alias="Activity">
<Seed>
<Class Type="System.WorkItem.Activity.ReviewActivity">
<Property ID="Id"/>
<Property ID="SequenceId"/>
<Property ID="Title"/>
</Class>
</Seed>
<Component Alias="ActivityAssignedTo">
<Seed>
<Class Type="System.Domain.User">
<Property ID="Domain"/>
<Property ID="UserName"/>
</Class>
</Seed>
</Component>
</Component>

<code>

So, all the components together created the XML file for the Projection that I needed.

Ok, so this is ONE piece of the puzzle. In order for the CSV import to work within Service Manager, you need a CSV file as well. Building the CSV file is actually quite easy. Simple use all

   <Property ID =”..”> <code>


tags as CSV headers.

Populate the file as needed. Now lets import the file. By the way, I have noticed that if the file is created in Excel (2013 at least) and saved a .csv, Excle uses “;” and NOT “,”. So simple open the application in Notepad and do a search and replace.

Sample file (CSV)

Headers are based on Property values within the XML File.

CR{0},CR notes,CR Title 1,CR Description 1,CR Contact Method,ChangePriorityEnum.Medium,ChangeImpactEnum.Standard,ChangeRiskEnum.Medium,CR Reason 1,FK,fletcherk,MA{0},0,MA Title 1,fk,fletcherk,MA{0},1,MA Title 2,fk,fletcherk,MA{0},2,MA Title 3,fk,fletcherk,MA{0},3,MA Title 4,fk,fletcherk,MA{0},4,MA Title 5,fk,fletcherk,MA{0},5,MA Title 6,fk,fletcherk,MA{0},6,MA Title 7,fk,fletcherk,RA{0},7,RA Title 1,fk,fletcherk

Please note that the Sequence ID can be changed to sort you needs. Remember that the Sequence Number will start at 0. The MA is the prefix for the Manual Activities and the RA is the prefix for Review Activities, please adjust as needed.

Also, the {0} ensures id are incremented correctly.

image pl

Select XML file and CSV file

image

image

image

image

You can import as many Change Requests as you wish using this method.

(E-Mail me)

image_thumb_thumb_thumb_thumb_thumb

Follow me.

facebook-small322252222 Facebook (Personal)

twitter-small322252222Twitter (Personal & System Center)

scsmlogo25232 Twitter (System Center Focused)

MCC11_Logo_Horizontal_2-color_thumb_