Prepare for Logging

As this script is intended to run unattended as a PowerShell job on a Windows server, Event logging will be used.

# start set the event source and start logging
New-EventLog -LogName "Application" -Source "CustomScripts" -ErrorAction SilentlyContinue
Write-EventLog -LogName "Application" -Source "CustomScripts" -EventId 1000 -EntryType Information -Message "CMDB True Up script Started"
# end set the event source and start logging