web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / DevBeard.com / New PowerShell Commandlets ...

New PowerShell Commandlets for Dynamics CRM

Henrik Gundersen Profile Picture Henrik Gundersen 978

I am about to make your day a bit better. Steel yourself.

Over at the TechNet Gallery, Kenichiro Nakamura posted 66 new PowerShell commands for manipulating Dynamics CRM. I have not had time yet to go through all these, and I can see that not all of them are documented acurately, but I have spent many many hours coding C# CLI applications that do similar things, and I keep redoing them. Now there is a framework available to us for doing it, and it is MIT licensed (aka go change it). This makes me very happy.

Here are the 66 functions in the .psm1 file:

  • Add-CrmActivityToCrmRecord
  • Add-CrmMultiRecordAssociation
  • Add-CrmNoteToCrmRecord
  • Add-CrmRecordAssociation
  • Add-CrmSampleData
  • Add-CrmSecurityRoleToTeam
  • Add-CrmSecurityRoleToUser
  • Connect-CrmOnlineDiscovery
  • Disable-CrmLanguagePack
  • Enable-CrmLanguagePack
  • Export-CrmSolution
  • Get-CrmAllLanguagePacks
  • Get-CrmEntityAllMetadata
  • Get-CrmEntityAttributeMetadata
  • Get-CrmEntityAttributes
  • Get-CrmEntityDisplayName
  • Get-CrmEntityDisplayPluralName
  • Get-CrmEntityMetadata
  • Get-CrmEntityName
  • Get-CrmEntityOptionSet
  • Get-CrmEntityRecordCount
  • Get-CrmEntityTypeCode
  • Get-CrmFailedWorkflows
  • Get-CrmGlobalOptionSet
  • Get-CrmLicenseSummary
  • Get-CrmOrgDbOrgSettings
  • Get-CrmRecord
  • Get-CrmRecords
  • Get-CrmRecordsByFetch
  • Get-CrmRecordsByViewName
  • Get-CrmSiteMap
  • Get-CrmSystemSettings
  • Get-CrmTimeZones
  • Get-CrmTraceAlerts
  • Get-CrmUserMailbox
  • Get-CrmUserSettings
  • Get-MyCrmUserId
  • Import-CrmSolution
  • Invoke-CrmRecordWorkflow
  • Invoke-CrmWhoAmI
  • Move-CrmRecordToQueue
  • New-CrmEntityReference
  • New-CrmMoney
  • New-CrmOptionSetValue
  • New-CrmRecord
  • Publish-CrmAllCustomization
  • Publish-CrmEntity
  • Remove-CrmEntityMetadataCache
  • Remove-CrmRecord
  • Remove-CrmRecordAssociation
  • Remove-CrmSampleData
  • Remove-CrmSecurityRoleFromTeam
  • Remove-CrmSecurityRoleFromUser
  • Remove-CrmUserManager
  • Set-CrmActivityRecordToCloseState
  • Set-CrmRecord
  • Set-CrmRecordOwner
  • Set-CrmRecordState
  • Set-CrmSystemSettings
  • Set-CrmUserBusinessUnit
  • Set-CrmUserMailbox
  • Set-CrmUserManager
  • Set-CrmUserSettings
  • Test-CrmSampleDataInstalled
  • Test-XrmTimerStart
  • Test-XrmTimerStop

Now breathe.

I have to highlight the couple I immediately think will change my world the most:

  • By letting IT operations create new users with New-CrmRecord, setting their defaults using Set-CrmUserSettings and giving them security roles using Add-CrmSecurityRoleToUser I can impose a regime where the people who control AD and in general identity management can also reach in to CRM and enforce. This is a stepping stone to using FIM/MIM fully integrated with CRM. Cool.
  • Export-CrmSolution and Import-CrmSolution are actually PowerShell commandlets I already created myself, but I would rather build on something others also use instead of rolling my own. Maintenance time saved. Connect these to a build and deploy system (TeamCity and Octopus Deploy for example), and CRM is almost a second grade ALM citizen. Now we only need proper source control, patching, no-downtime-release and differencing for solution files natively.
  • DSC for CRM in general. A lot of these commands allow us to specify and test for a system end state when rolling out new environments. I see a bright future where we can install a new environment, provision language packs, import data and users and test the system - all automatically and by script. Unfortunately, DSC requires immutability, so you have to chain a couple of these together to achieve that, but it is so much closer than anything we have available elsewhere, like SSIS shapes and MSBUILD/C# frameworks. PowerShell is really the common language between dev and ops, so write new things in PS please.

Kudos to Kenichiro Nakamura and (Siri Harper for the tip); I owe you one.

EndOfLine


This was originally posted here.

Comments

*This post is locked for comments