Comparing ConfigMgr Date Formats in PowerShell

If you have worked with ConfigMgr much, you know that uses WMI to stores tons of information.  WMI uses the CIM_DATETIME format, which looks like this: yyyymmddHHMMSS.mmmmmmsUUU.  In order to work with this in PowerShell, you need to convert it into something that the Get-Date cmdlet can understand.  Here are two ways that you can accomplish this:

Using the ManagementDateTimeConverter Class:

get-date ([]::todatetime('20141004185400.000000+***'))

or by using the ConvertToDateTime() method:


And here is an example for a required deployment policy comparing the EnforcementDeadline to the current date:

$EnforcementDate = Get-WmiObject -Namespace "root\ccm\Policy\Machine\RequestedConfig" -Class CCM_ApplicationCIAssignment | Where-Object { (($_.AssignmentName -eq 'My Application_Install') -and ($_.EnforcementDeadline -ne $null))}
$DeadlinePast = $EnforcementDate.ConvertToDateTime($y.EnforcementDeadline) -lt (Get-Date)

Originally posted on

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.