-
슬랙 윈도우 로그인 ScriptsIT 2020. 3. 26. 16:10
#로그인 완료 시
Add-Type -AssemblyName System.Net.Http
$http = New-Object -TypeName System.Net.Http.Httpclient
$message = "IP_원격접속"
#$Events = Get-WinEvent -FilterHashtable @{Logname='Microsoft-Windows-TerminalServices-LocalSessionManager/Operational'; id=1149} -MaxEvents 1| Format-List -Property * | Out-File C:\1\login_ok.csv
$Events = Get-WinEvent -FilterHashtable @{Logname='Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational'; id=1149} -MaxEvents 1 | Format-List -Property * | Out-File C:\1\login_ok.csv
$csv = Get-Content -Path C:\1\login_ok.csv | Select-String -List 1
#$csv = Get-Content C:\test.csv | Where-Object { $_.Contains("Message") }
$httpMessage = "{""text"": """ + $message + $csv +"""}";
$content = New-Object -TypeName System.Net.Http.StringContent($httpMessage)
$httpResult = $http.PostAsync("슬랙훅주소", $content).Result'IT' 카테고리의 다른 글
aws s3 cp 전체파일 (0) 2020.03.30 발송 메일 확인 (0) 2020.03.26 4.4.2 Message submission rate for this client has exceeded the configured limit (0) 2020.03.20 PST Export Import (0) 2020.03.19 aws alb 리다이렉트 (0) 2020.03.16