![[파이썬]텔레그램 푸시(2023버전)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbVa7Ap%2FbtrWrJBeAov%2FAAAAAAAAAAAAAAAAAAAAAIbXVAtSVXJ0WhuRxsmw_0h_RdkxYacRLUELoHnzh5-I%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3Dtthsq2dDrJw%252Frxwkihv9eAFh9uQ%253D)
파이참을 작성해서 텔레그램 푸시를 테스트해볼려고하니 기존에 사용했던 방식은 먹히지 않아 구글링해본 결과 최근 텔레그램봇이 v20으로 업데이트 되면서 문제가 발생 해서 아래와 같이 하면 동작. import telegram import asyncio chat_token = "#############################" bot = telegram.Bot(token = chat_token) text = '안녕하세요' #### 리눅스에서는 아래 코드 삭제 또는 주석처리해야함 #### asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.run(bot.sendMessage(chat_id = "#############..
![[파워쉘]윈도우 시간동기화 실패시 텔레그램 푸시](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FBojY4%2FbtrCfmzbpji%2FAAAAAAAAAAAAAAAAAAAAAF_xlbdAuSo-6IR6NS-vzf1Nl8LUDHE0S7QKTwB6Urdy%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DpfVqy%252BmtMqdYaBsDZz%252BAO4gfiEk%253D)
$hostname = hostname $events=Get-WinEvent -FilterHashtable @ -MaxEvents 1 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $token = "#####################" $chatId = "#####################" $message = $events.message Invoke-RestMethod -Uri "https://api.telegram.org/bot$token/sendMessage?text=$message&chat_id=$chatId"
![[파워쉘]Guest계정 상태 확인](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbZEJFu%2FbtrCiuwuqHg%2FAAAAAAAAAAAAAAAAAAAAAJKWuCRmBf29bLtVcYbuST76FwCCnuQBS3rzxapS7pNh%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3DFEJcbalIjVtaVp0cUnnnRQ19Naw%253D)
guest계정은 보안상 비활성화하는게 좋습니다. 아래는 파워쉘로 guest계정이 비활성화되어있는지 상태를 확인하는 스크립트입니다. Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='$true' and Name='Guest'"|Select-Object Name,Disabled|Format-Table -AutoSize 참조 : https://social.technet.microsoft.com/Forums/windowsserver/en-US/31eeea8c-e268-4dd0-8a62-4fc44e87f3a2/check-if-a-local-user-account-is-disabled-on-a-remote-computer?forum=winserverman..
![[파워쉘]텔레그램 푸시](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FoNlOk%2FbtrCiaE7hdy%2FAAAAAAAAAAAAAAAAAAAAAPMolZN_rdjVnnTNyVkmheSNRPCEfgY_EbiYJPelri9R%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1753973999%26allow_ip%3D%26allow_referer%3D%26signature%3D8UVrt3CqDw0mgL2x%252BQdGmyRNofM%253D)
아래 내용 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 테스트~~~