SCCM Run Script – Gather SCCM Log files for PowerShell v4 and earlier

I previously wrote a short post and did a demonstration video of the Run Scripts feature in Microsoft System Center Configuration Manager – https://morethanpatches.com/2018/02/12/sccm-run-scripts-pre-release-feature/

In that demo I used an example script created by Jörgen Nilsson which ran on the client, zipped up the SCCM log files folder and copied to back to a central file share. After some further testing with a slightly amended version of this I found that it was applicable only for machines running with PowerShell version 5 and newer as it uses the “Compress-Archive” cmdlet which is not available in older versions. This amended script uses a different method which is both forwards and backwards compatible so can be used with Windows 10 as well as your older systems.

image

I have uploaded the script to the Microsoft TechNet Gallery where you can download and test. Please do test this in your own environment before running it on any production systems, the risk is yours.

https://gallery.technet.microsoft.com/SCCM-Run-Script-Gather-CM-bf3898a9

Guidance on how to use the run scripts feature can be found in my previous post as mentioned above. Let me know how you get on.

/Peter

Leave a comment

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