I have been trying to automate the creation of business service objects using a CSV file however ran into an error. This post details what the error was and how I solved it using Orchestrator.
I have a CSV file which I can import my service definitions in from – however when testing the creation of a new service I ran into an error. The basic premise is that the New-SCSMObject from the SMLets module will allow a hash table of properties to be passed to it when creating an object. So in the beginning my script looked like the entry below.
This should work perfectly however when I ran the script I got the error below.
The error detailed at https://msdn.microsoft.com/en-us/library/hh962858.aspx wasn’t much help but I though back to when I was creating comments inside a Runbook. In that instance I was running into an error because it was missing a GUID. I decided to cheat a bit and jumped into Orchestrator – using a Create Object activity I specified a business service and the required field popped up straight away.
The service ID is a GUID so all I had to do was alter my hash table to add a ServiceID property with a new GUID value. Next time I ran the script there were no issues and my service was created.