-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forensics script update and adding startup-probe
- Loading branch information
1 parent
743fab2
commit 3434daa
Showing
2 changed files
with
74 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Start transcript for logging | ||
$hostname = hostname | ||
$probeLog = "C:\fileshare\startup-probe-$hostname.log" | ||
Start-Transcript -Path $probeLog | ||
|
||
$logFilePath = "C:\Profisee\Configuration\LogFiles\SystemLog.log" | ||
$successString = "User Manager\\ContainerAdministrator Profisee platform configuration finished." | ||
$checkIntervalSeconds = 5 | ||
|
||
|
||
# Main loop | ||
while ($true) { | ||
Write-Host "Parsing log file for success and failure strings..." | ||
if (Test-Path $logFilePath) { | ||
# Get the entries for success and failure strings | ||
$successEntries = Get-Content -Path $logFilePath | Select-String -Pattern $successString | ||
|
||
# Get the counts of the entries | ||
$successCount = $successEntries.Count | ||
|
||
# 1. If success count > 0, break successfully. | ||
if ($successCount -gt 0) { | ||
Write-Host "Configuration finished. There may be errors." | ||
break | ||
} | ||
} else { | ||
Write-Host "Log file not found." | ||
} | ||
|
||
# Sleep before checking again | ||
Start-Sleep -Seconds $checkIntervalSeconds | ||
} | ||
|
||
Stop-Transcript |