I wrote a PowerShell script that looks like this:
foreach ($li in $list) {
try {
#check ID in the hashtable for new topics
if ($TopicUpdates.ContainsKey($li["ID"].ToString())) {
$li["Topics"] = $TopicUpdates[($li["ID"].ToString())]
$li.SystemUpdate($false)
} else {
$li["Topics"] = 'About'
$temp = "" | select "Title", "ID"
$temp.Title= $li["Title"]
$temp.ID= $li["ID"]
if ($li.File.CheckOutStatus -eq "None") {
$li.SystemUpdate($false)
} else {
$CheckedOutAlbums.Add($temp)
}
$NonExistingTopics.Add($temp)
}
} catch {
$isError = $true
$time = Get-Date
$ErrorMessage = $_.Exception.Message
"Error Occurred ($time) with error message: $ErrorMessage" |
Out-File ".\error.log" -Append
}
}
I noticed that whilst the script is running, it logs integers in the console:
1 2 3 etc.
What could cause this? I haven't written any Write-Host
statements.