Transaction support for PowerShell cmdlets
today when using powershell cmdlet the action is performed direct against the server, as example, if you want to create an application, add couple of deployment types and perform other small changes, you end up with lots of revisions (easily, 10). when you have lots of revisions, this start to impact the performance.
it would be nice if we can have the cmdlets transactional, in this case, you create the object and the changes does not apply to the database, you need to "save" the change.
on the application example, you could create the application, create the dt's, changes, etc. and at the end, user a "save" cmdlet and the data is written to the database, ending up with only 1 revision.
Ira Malinich commented
Currently, to create an application requires at least two separate actions like this:
New-CMApplication -Name "TestApp1";
Add-CMMsiDeploymentType -ApplicationName "TestApp1" -ContentLocation "\\TestServer\Share\TestApp1.msi";
This creates a new application starting at Revision 2 at least, more if I have to work around some bugs in New-CMApplication by using Set-CMApplication afterward, or if dependencies are required. If we could use something like New-CMMsiDeploymentType to create a new deployment type object in memory, then pass it to New-CMApplication which could create the application object in the database, complete with deployment type and any attached dependencies.
I hope this would be less transactionally expensive when creating multiple applications in a batch, while reducing the revision counter.
That might look something like this:
$NewDepType = New-CMMsiDeploymentType -ApplicationName "TestApp1" -ContentLocation "\\TestServer\Share\TestApp1.msi";
New-CMApplication -Name "TestApp1" -DeploymentTypeObjects $NewDepType;
AdminAdam Meltzer (ConfigMgr Product Team) (Software Engineer, System Center Configuration Manager) commented
Thanks for the feedback! We now have an item in our backlog to start adding transactional support into select cmdlets and are looking to have this available in a future release.