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
(3)
285 times
Add to favorites
System Center
3/13/2018
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • 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\CMlogs.zip -Destination $Computerlogshare