How to Automate The Collection of SOTI MobiControl Deployment Server Logs
Summary
Related SOTI ONE Platform Products
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?
Thanks for your feedback