How to Automate The Collection of SOTI MobiControl Deployment Server Logs

Publish Date: 05-Jan-2024 Last Modified Date: 29-Aug-2025 SOTI MobiControl, SOTI XSight, SOTI Connect
1960 0

Summary

How to automate server log collection using PowerShell scripts and Windows Task Scheduler.

Related SOTI ONE Platform Products

SOTI MobiControl;SOTI XSight;SOTI Connect

Situation

Automate the collection of logs using PowerShell scripts and Windows Task Scheduler.

Environment

  • SOTI MobiControl
  • SOTI XSight
  • SOTI Connect
  • SOTI Assist.

Process Description

1. On the target server, open Powershell ISE as an administrator.

2. Use the following script to copy the Deployment Server Extension (DSE) logs from the ProgramData folder:

# Log file pattern
$Pattern = "DeploymentServerExtensions*"

# Get the current date and time
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"

# Create a folder with the current date and time
$folderPath = New-Item -ItemType Directory -Path "D:\Logsbackup\$dateTime"

# Copy files to the newly created folder
$sourcePath = "C:\ProgramData\SOTI\*"
$filesToCopy = Get-ChildItem -Path $sourcePath -File -include $Pattern

foreach ($file in $filesToCopy) {
    $destinationPath = Join-Path $folderPath.FullName $file.Name
    Copy-Item -Path $file.FullName -Destination $destinationPath
}

Write-Host "Files have been copied to the folder: $($folderPath.FullName)"

3. Use the following script to copy the Deployment Server (DS) logs from the ProgramData folder:

# Log file pattern
$Pattern = "MCDeplSvr*"

# Get the current date and time
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"

# Create a folder with the current date and time
$folderPath = New-Item -ItemType Directory -Path "L:\DsLogs\$dateTime"

# Copy files to the newly created folder
$sourcePath = "C:\ProgramData\SOTI\*"
$filesToCopy = Get-ChildItem -Path $sourcePath -File -include $Pattern

foreach ($file in $filesToCopy) {
    $destinationPath = Join-Path $folderPath.FullName $file.Name
    Copy-Item -Path $file.FullName -Destination $destinationPath
}

Write-Host "Files have been copied to the folder: $($folderPath.FullName)"

4. Schedule script execution at regular intervals using Task Scheduler to automate log collection.

Note: Find more details about creating automated tasks, see How to create an automated task using Task Scheduler on Windows 10.

Was this helpful?