# create_new_user_push.ps1 생성 $events=Get-WinEvent -FilterHashtable @ -MaxEvents 1 foreach($Event in $Events){ $eventXMLs = [xml]$Event.ToXml() foreach($eventXML in $eventXMLs){ $logs = New-Object psobject -Property @{ newUser = $eventXML.Event.Eventdata.Data[0].'#text' Server = $eventXML.Event.Eventdata.Data[1].'#text' createuser = $eventXML.Event.Eventdata.Data[4].'#text' } } } $token = "#####..
# ps1파일 생성(예 : login_push.ps1) $Events = Get-WinEvent -FilterHashtable @ foreach($Event in $Events){ $eventXMLs = [xml]$Event.ToXml() foreach($eventXML in $eventXMLs){ #$eventXML.Event.EventData.Data $logs = New-Object psobject -Property @{ User = $eventXML.Event.UserData.EventXML.User IPAddress = $eventXML.Event.UserData.EventXML.Address TIME = $event.timecreated EventID = $eventXMLs.Event.syst..
# powershell -ExecutionPolicy ByPass -File [파워쉘파일]
아래 내용 test.ps1로 저장 $token = "#########################" $chatId = "################" $message = $args Invoke-RestMethod -Uri "https://api.telegram.org/bot$token/sendMessage?text=$message&chat_id=$chatId" 실행 powershell -executionpolicy bypass test.ps1 테스트~~~
# 변경할 날짜지정 $d = Get-Date "02/09/2013 4:59 PM" # 변경할 파일 대상 지정 $f = Get-Item "C:\test\test.txt" # 변경할 파일에 변경할 날짜 적용 $f.LastWriteTime = $d 출처 : http://stackoverflow.com/questions/21630424/modifying-lastwritetime-directory-in-powershell