PowerShell module used for managing Microsoft Endpoint Manager Configuration Manager distribution point content.
Branch | Build status | Last commit | Latest release | PowerShell Gallery | GitHub |
---|---|---|---|---|---|
master |
PowerShell module used for managing Microsoft Endpoint Manager Configuration Manager distribution point content.
Here are some of the things you can do with it:
PSCMContentMgmt is a mix of being no more than a wrapper for MEMCM cmdlets or native binaries. Some functions query WMI or invoke WMI methods.
PSCMContentMgmt does not intend to reinvent the wheel from already available cmdlets. Instead it provides a simpler workflow for managing your distribution points by offering:
Install and import:
Install-Module PSCMContentMgmt -Scope CurrentUser
Import-Module PSCMContentMgmt
Each function will have two parameters to communicate to your environment with:
-SiteServer
: the FQDN server address of your site server (SMS Provider)-SiteCode
: the site code of the environmentUsing these parameters once for any function of PSCMContentMgmt enables you to not specify them again. These values are held in memory for as long as the PowerShell session exists.
In other words, if you used Get-DP
and passed the parameters -SiteServer
and -SiteCode
, you do not need to specify them again in subsequent uses of Get-DP
, and any other function of PSCMContentMgmt.
If the first function you use after importing PSCMContentMgmt requires -SiteServer
and -SiteCode
and you have not passed the parameters, you will be prompted for them.
If you want to change the values of -SiteServer
or -SiteCode
, pass those parameters again for any function and those new values will be used for subsequent calls.
This is intended to provide a fluid user experience where you need not to repeatedly specify these required parameters while using the module interactively. You will notice using Get-Help
on any functions of PSCMContentMgmt will indicate these parameters are not mandatory. However the user experience will indicate otherwise. This design choice, which favours user experience, does sacrifice the discoverability of these parameter’s mandatory requirement.
Where any of the functions return an object with the property ObjectID, or where a parameter is named -ObjectID, it will always be the PackageID for all content objects (Packages, Driver Packages, Boot Images etc) except for Applications/Deployment Types where it is CI_ID. This enables you to have a property ready to use for Applications with any of the cmdlets from the Configuration Manager module.
Get-Help "about_PSCMContentMgmt_ExportImport"
To learn more about how to migrate distribution point content using PSCMContentMgmt, please see my SysManSquad blog post or read the help topic Get-Help about_PSCMContentMgmt_ExportImport
.
Get-DP -Name "SERVERA%", "SERVERB%" -Exclude "%CMG%"
Return distribution points which have a ServerName property starting with SERVERA
or SERVERB
, but excluding any that match CMG
anywhere in its name.
Get-DP | Get-DPDistributionStatus -DistributionFailed | Group-Object -Property DistributionPoint
Return all distribution points, their associated failed distribution tasks and group the results by distribution point now for an overview.
Get-DP | Get-DPDistributionStatus -DistributionFailed | Start-DPContentRedistribution
Return all distribution points, their associated failed distribution tasks and initiate redistribution for them.
Get-DP -Name "London%" | Get-DPContent
Return all content objects found on distribution points where their ServerName starts with “London”.
Note: the same is available for groups with Get-DPGroup and Get-DPGroupContent
.
Compare-DPContent -Source "dp1.contoso.com" -Target "dp2.contoso.com"
Return objects which are on dp1.contoso.com but not on dp2.contoso.com.
Note: the same is available for groups with Compare-DPGroupContent
.
Compare-DPContent -Source "dp1.contoso.com" -Target "dp2.contoso.com" | Start-DPContentDistribution -DistributionPoint "dp2.contoso.com"
Distribute the missing objects to dp2.contoso.com.
Note: the same is available for groups with Start-DPGroupContentDistribution
.
Get-DPContent -DistributionPoint "dp1.contoso.com" -Package | Remove-DPContent
Remove all Packages from a distribution point.
Note: the same is available for groups with Get-DPGroupContent
and Remove-DPGroupContent
.
Invoke-DPContentLibraryCleanup -DistributionPoint "dp1.contoso.com" -Delete
Invoke the ContentLibraryCleanup.exe tool.
Find-CMObject -ID "ACC00048"
Finds any object which has the PackageID “ACC00048”, this includes applications, collections, driver packages, boot images, OS images, OS upgrade images, task sequences and deployment packages.
Find-CMObject -ID "17007122"
Finds any object which has the CI_ID “17007122”, this includes applications, deployment types, drivers, configuration items and configuration baselines.
Find-CMObject -ID "ScopeId_B3FF3CC4-0319-4434-9D24-77689C53C615/Application_197d8de7-022d-4c0b-aec4-c339ccc17ba4"
Finds an application which matches the ModelName “ScopeId_B3FF3CC4-0319-4434-9D24-77689C53C615/Application_197d8de7-022d-4c0b-aec4-c339ccc17ba4”
Remove-DPContent
and Remove-DPGroupContent
only removes items that are fully distributed.Export-DPContent
(which is essentially just Publish-CMPrestageContent
).For help, be sure to use Get-Help
to check out the About help pages or the comment based help in each of functions (which includes examples). Example commands below if you’re unsure:
Get-Help "about_PSCMContentMgmt*"
Get-Help "Find-CMObject" -Detailed
Failing that: