PowerShellでFileMaker Serverの「Event.log」を監視し、"警告" を含む行を通知
MonitorLog.ps1
function Send-Text($Text='Sample Text', $Port=50210) {$remoteIPstr='127.0.0.1';<#通知を受け付けるPCのIPアドレス#>$remoteIP = [System.Net.IPAddress]::Parse($remoteIPstr);$endpoint = New-Object System.Net.IPEndPoint ($remoteIP,$Port); $udpclient= New-Object System.Net.Sockets.UdpClient; $bytes=[Text.Encoding]::UTF8.GetBytes($Text); $bytesSent=$udpclient.Send($bytes,$bytes.length,$endpoint); $udpclient.Close();}powershell -NoProfile -ExecutionPolicy Unrestricted .\MonitorLog.ps1
※一時的に実行ポリシーを変更して 実行
MonitorLog.ps1 のあるディレクトリに移動して実行する
プログラム/スクリプト: powershell
引数の追加: -NoProfile -ExecutionPolicy Unrestricted .\MonitorLog.ps1
開始(オプション): C:\Users\PCUSER\Documents\Script
※「開始(オプション):」は、MonitorLog.ps1 のあるディレクトリを設定