SCCM Run Script - Gather SCCM Logs for PowerShell v4 and earlier

This script is intended to be used with the Run Script feature in Microsoft System Center Configuration Manager. It is based originally on a script created by Jörgen Nilsson but has been amended for usage with machines that have PowerShell v4 and earlier.

3.7 Star
866 times
Add to favorites
System Center
E-mail Twitter Digg Facebook
  • This doesn't work on non-domain/workgroup clients?
    3 Posts | Last post July 09, 2018
    • I tested on my environment and it doesn't pull from non domain clients.
    • Done on a test LAB environment.
    • Modified the script section #Copy zipped logfile to servershare (see below)
      #Copy zipped logfile to servershare
      $user = "domain\user"
      $pass = "yourpassword"
      $SeccureStringPwd = $pass | ConvertTo-SecureString -AsPlainText -Force
      $cred = New-Object System.Management.Automation.PSCredential -ArgumentList $user, $SeccureStringPwd
      New-PSDrive -Name X -PSProvider FileSystem -Root "\\ip or FQDN\share\folder" -Credential $cred
      $Computerlogshare=$logshare + “\” + $env:Computername
      Write-host $Computerlogshare
      New-Item -Path $Computerlogshare -ItemType Directory -Force
      Copy-Item $env:temp\ -Destination $Computerlogshare