繁体   English   中英

Azure PowerShell - 向 VM 发送消息

[英]Azure PowerShell - Send Message to VM

我正在使用 PowerShell 在 Azure 自动化帐户中创建一些脚本,并且我想向 Azure VM 上的用户发送一个弹出窗口。 如果可能,它将是一个弹出窗口,将响应发送回脚本。

有关更多详细信息:我正在编写一个脚本来检查 VM 中包含用户工作时间的标签,然后在结束时间后两小时关闭 VM(很容易)。 但是以防万一用户工作迟到/被叫出来,我想给他们发送一条消息以保存他们的工作。 如果弹出窗口可以向 PowerShell 发送响应,那么我希望弹出窗口显示“OK”或“延迟 1 小时”。 在任何一种情况下,脚本都会在五分钟后继续运行,以防他们没有响应。 该脚本将每小时运行一次,因此如果响应延迟,则只需“继续”即可。

先感谢您。

• 您可以为您的目的创建一个交互式toast 通知,以达到注销和关闭系统的晚上时间。 要查找此类交互式 toast 通知的模板并对其进行配置,请参阅以下文档链接。 此外,您可以通过在特定时间点借助任务计划程序对其进行配置,将 toast 通知发送到远程计算机以作为 powershell 脚本运行

https://docs.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=builder-syntax

上面的链接帮助您designing the toast notification and its content like message, image, notification alignment, etc. You can also use the below github link's 'Toast_Notify.ps1' powershell script to modify and configure the required notification要在远程计算机: -

https://github.com/byteben/Toast/blob/master/Toast_Notify.ps1

• 此外,找到使用上述脚本本身创建的toast 通知的以下示例,您必须在其中修改脚本中的“XML”内容以获得所需的toast 通知

 <?xml version="1.0" encoding="UTF-8"?>
 <ToastContent>
  <ToastTitle>We want to bring to your attention some important information. Please review the details below before contacting the Service Desk</ToastTitle>
   <Signature>Sent on behalf of the ICT Service Desk</Signature>
  <EventTitle>Major IT Issues - Flooding</EventTitle>
   <EventText>We are currently experiencing problems with all our systems. We are drinking coffee with our feet up and will provide an update shortly. Thank you for your patience</EventText>
    <ButtonTitle>Details</ButtonTitle>
    <ButtonAction>https://byteben.com</ButtonAction>
    </ToastContent>

Toast 通知图片:-

Toast 通知图片

执行上述脚本的 Powershell 命令脚本:-

 PowerShell.exe -File “Toast_Notify.ps1” -XMLOtherSource \\MyFileServer\Toast Notifications Custom Message\CustomMessage.xml ‘

有关上述内容的详细信息,请参阅以下链接:-

https://byteben.com/bb/deploy-service-announcement-toast-notifications-in-windows-10-with-memcm/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM