-1

I have used PowerShell scripts which list deployments name and/or state for a given machine, however they do not list the deployment's "Scheduled Time" which I am after (see screenshot).

I basically want to program a script that asks for deployment name (e.g. Notepad++ - Install) and then it would return the scheduled time of this deployment. Is this at all possible?

Scheduled Time Highlighted

henrycarteruk
  • 12,708
  • 2
  • 36
  • 40
Rakha
  • 1,874
  • 3
  • 26
  • 60

1 Answers1

2

Assignments are available in the AssignedSchedule-property in the objects returned from Get-CMPackageDeployment.

AFAIK you can't set a deployment name in SCCM 2012+ like you could with advertisement name in 2007, so the sample below uses PackageName instead. You can change this to PackageID, CollectionID etc. Ex:

#Remember to import SCCM module and switch to sitename PSDrive, ex: Set-Location C00:
Get-CMPackageDeployment -Name ".NET Framework 4.6.2" | Select-Object PackageID, ProgramName, CollectionID, PresentTime, @{n="Assignments";e={$_.AssignedSchedule.StartTime}}

PackageID ProgramName            CollectionID PresentTime         Assignments                               
--------- -----------            ------------ -----------         -----------                                                   
C0000AF4  Install NET Framework  C000042D     16.03.2017 20:44:00 16.03.2017 20:44:00                       
C0000AF4  Install NET Framework  C0000BF2     03.05.2017 21:07:00 {03.05.2017 21:30:00, 03.05.2017 22:00:00}

PresentTime in the sample above is the "available date". Assignments above only show the start-time. If you have a reoccuring schedule you can get them from the same AssignmentSchedule-objects.

Frode F.
  • 52,376
  • 9
  • 98
  • 114