SCCM Reports: Automated Updates on Fresh Deployments
Modifying the Date Range for SCCM Email Deployment Reports
A custom PowerShell script, , has been developed to automate the sending of email reports detailing new SCCM deployments. The script uses native SCCM methods to compile and send out these reports, but it does not specify the programming language used in its development or the frequency at which these reports are sent.
The automated report provides a summary of deployments created within the last seven days, as defined by the and values. To modify the date range in this script to send email reports of new deployments within a custom time frame, you need to update or add parameters that specify the start and end dates (or a relative time range) used to filter deployment data when querying SCCM.
To do this, locate where the script queries SCCM deployment data, usually with a WMI or PowerShell cmdlet filtering by a date property such as deployment start time or creation time. Change the date filter values or variables from fixed to dynamic/custom, for example by passing in and parameters to the script.
Here's an example of how to modify the filter clause:
```powershell $startDate = Get-Date "2025-08-01" $endDate = Get-Date "2025-08-15" ...
$deployments = Get-WmiObject -Namespace "root\SMS\site_ABC" -Query "SELECT * FROM SMS_DeploymentInfo WHERE DeploymentStartTime >= '$($startDate.ToString('yyyyMMddHHmmss.000000+000'))' AND DeploymentStartTime <= '$($endDate.ToString('yyyyMMddHHmmss.000000+000'))'" ```
Then, the email report logic uses to send a summary only of deployments in that range.
If the script currently only filters by a static date range (e.g., last 7 days), modify that logic to accept parameters or calculate dates dynamically.
Since the script is a community or custom script, check the script code for any variables or parameters defining the date range. Commonly this would be a or parameter or a line where or similar is hard-coded. Modify it to your desired date range or add parameters for flexible input.
For further assistance with identifying and adjusting the relevant part of the script code, please provide the script's code snippet.
The script sends an email containing the results of the report, but it does not provide information about the prerequisites or installation process. Updating the date range values affects the deployments included in the report.
To customize the date range for the email deployment reports generated by the PowerShell script, you need to update or add parameters that specify the start and end dates for the query of SCCM deployment data. This can be achieved by modifying the date filter values or variables from fixed to dynamic/custom, such as passing in and parameters to the script.
Once you've modified the script to dynamically define the date range, the automated report will provide a summary of deployments based on the updated time frame rather than the predefined period of the last seven days.