简体   繁体   English

Powershell / SCCM-通过Powershell(或其他)获取SCCM部署的“计划时间”?

[英]Powershell/SCCM - Get an SCCM deployment “Scheduled time” via powershell (or other)?

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). 我使用了PowerShell脚本,该脚本列出了给定机器的部署名称和/或状态,但是它们没有列出我所遵循的部署的“计划时间”(请参见屏幕截图)。

I basically want to program a script that asks for deployment name (eg Notepad++ - Install ) and then it would return the scheduled time of this deployment. 我基本上想编写一个脚本来询问部署名称(例如Notepad++ - Install ),然后它将返回此部署的计划时间。 Is this at all possible? 这是可能吗?

预定时间突出显示

Assignments are available in the AssignedSchedule -property in the objects returned from Get-CMPackageDeployment . Get-CMPackageDeployment返回的对象中的AssignedSchedule属性中可以使用AssignedSchedule

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. AFAIK不能像在2007年使用广告名称那样在SCCM 2012+中设置部署名称,因此下面的示例改用PackageName。 You can change this to PackageID, CollectionID etc. Ex: 您可以将其更改为PackageID,CollectionID等。例如:

#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". PresentTime的示例中的PresentTime是“可用日期”。 Assignments above only show the start-time. 上面的分配仅显示开始时间。 If you have a reoccuring schedule you can get them from the same AssignmentSchedule -objects. 如果您有重新计划,则可以从相同的AssignmentSchedule -objects获取它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM