Skip to main content

Service Manager Incident Load Test PowerShell Script

Author by Rob Plank

I have added a few features to the Load Test script that was posted here by Matthew Dowst. The original post talks about how this script can help you identify workflow and other performance issues, this script can do that too but it also can be used to populate a test/dev/demo database with Incidents that you can build reports off of based on users assigned to the incident or the affected user of the incident. This new version of the script adds random values for affected user, Assigned To User, Primary Owner user and priority to the Incidents that the script creates.  The random priority you can adjust the limits as needed by editing the main/max priority variable. There was a catch to adding the related users to the incidents, In environments with 200,000+ users you don’t want to just run “Get-SCSMobject –Class System.User$ | Get-Random” The command will take minutes to complete, if it ever completes. To work around this issue I created a function to call if you have a large environment, the function will get a random group of users and then select from that small subset of users throughout the rest of the script. I added a variable called $LargeSMEnvironment  to control if this function is called or not. you can set it to true for large environments or if you have a smaller size environment you can set it to false. If you leave the $LargeSMEnvironment set to true you will need to review the SMlets query in the script. You may want to refer to a blog post Travis Wright did here. He explains how to use search criteria instead of the –Filter. You will want to review the whole script before running it the first time as there is a few parts you may want to edit to fit your environment and the query I mentioned before. I have tried to make all of the locations stand out with comment blocks above them. You can download the script from the TechNet Gallery.

Rob Plank

Systems Engineer