July 2018
Beginner
552 pages
13h 18m
English
All SCCM logs have the same pattern, which makes log file parsing, but also creation, very easy. The following Write-CMLogEntry function creates log files with this specific type:
function Write-CMLogEntry{ <# .Synopsis Logs the entry in an CMTrace-compatible format to an logpath. .EXAMPLE Write-CMLogEntry -Value 'Example' -Severity 2 -LogFilePath $LogFilePath .EXAMPLE $TSEnvironment = New-Object -ComObject Microsoft.SMS.TSEnvironment -ErrorAction Stop $LogFilePath = Join-Path -Path $Script:TSEnvironment.Value('_SMSTSLogPath') -ChildPath $FileName Write-CMLogEntry -Value 'ExampleWithLogFilePath' -Severity 1 -LogFilePath $LogFilePath .EXAMPLE Begin { # Construct TSEnvironment object try { $TSEnvironment = New-Object -ComObject ...
Read now
Unlock full access