Let's say I run:
Get-CMDeployment -CollectionName "gar25*" | select CollectionName, ApplicationName, PackageID, DeploymentTime, EnforcementDeadline | out-gridview
This gives me all the info I need on multiple deployments associated to a user, but the value "EnforcementDeadline" is blank, which i'm guessing is a lazy property. How would I retrieve it? I have found this article:
but i'm really struggling to adapt the code.
Thanks a lot for your time.
EnforcementDeadline
is a property for application deployments. You're trying to read it from a package deployment where it doesn't exist because they can have multiple assigned schedules which can be both one time or recurring (ex. daily). If you use Get-CMApplicationDeployment
and Get-CMPackageDeployment
you will get the right type of objects so you can access the values.
I've included a sample that will detect if the deployment is for a package and retrieve the StartTime
-values for it's schedules (I assume they are non-reccuring).
$DeadlineColumn = @{
Name="EnforcementDeadline"
Expression={
if($_.FeatureType -eq 2 -or $_.FeatureType -eq 7) {
#Package or task sequence
#Get assignment-starttime (ignoring daily/hourly etc.)
(Get-CMPackageDeployment -DeploymentId $_.DeploymentID).AssignedSchedule | Select-Object -ExpandProperty StartTime
} else {
#Application
$_.EnforcementDeadline
}
}
}
Get-CMDeployment -CollectionName "abc" | select CollectionName, ApplicationName, PackageID, DeploymentTime, $DeadlineColumn | out-gridview