Setting multiple properties

Jun 3, 2011 at 7:21 PM

I'm trying to set multiple properties on incidents using Set-SCSMObject.  I know how to set a single property using -Property and -Value.  Is it possible to set multiple properties in a single command?

Developer
Jun 8, 2011 at 11:47 PM

use the PropertyHashtable parameter:

$incident | set-scsmobject -propertyHashtable @{
   TargetResolutionTime = [datetime]::Now.AddDays(60)
   ContactMethod = "by pony express"
}

jim

Jun 22, 2011 at 11:38 AM

Hello,

I'm experiencing problems setting the dateTime when executing the commandline above.

Do you have any idea what could cause the error? I copied the set-scsmobject part of the command line and executed it.

This is the error message:

Set-SCSMObject : Simple object value was not the proper type.
At line:1 char:104
+ Get-SCSMObject -Class (Get-SCSMClass System.WorkItem.Incident$) -Filter "ID -eq IR487" | Set-SCSMObject <<<<  -proper
tyHashtable @{
    + CategoryInfo          : ObjectNotFound: (21/08/2011 13:33:11:DateTime) [Set-SCSMObject], InvalidSimpleObjectValu
   eException
    + FullyQualifiedErrorId : Could not assign date ,SMLets.SetSMObjectCommand

Oliver

Developer
Jun 22, 2011 at 4:18 PM

if you are using the exact line as above, it could be a misrecognition of the datetime format. What culture is your OS set to?