目录

SSH/RDP 发送提醒当登录时

申请机器人

Telegram

申请步骤

  • 注册 telegram
  • 寻找 @BotFather 账号
  • 输入 /newBot
  • 输入 名称 申请

API 测试

登录执行命令

RDP

配置计划任务

  1. 找到 TaskScheduler
  2. 右侧 Create Task...

创建计划任务

  1. 设置 General
    1. Name: LoginSayHello
  2. 设置 Tigger
    1. Begin the task: On workstation unlock
  3. 设置 Actions
    1. Program/script: curl
    2. Add arguments: https://api.telegram.org/bot123456:abcd/sendMessage?chat_id=1062857492&text=%23Logined%0AAzure
  4. 设置 Conditions
    1. Power Start the task only if the computer is on AC power

SSH

配置登录命令

echo "echo Hello `whoami`" > /etc/profile.d/logined.sh

配置发送消息

echo "curl https://api.telegram.org/bot123456:abcd/sendMessage?chat_id=1062857492&text=%23Logined%0AVirmach" > /etc/profile.d/logined.sh