我有一个脚本,运行在当前的用户空间,但在后台,永久最小化。
它需要通过系统托盘或Windows.UI.Notifications机制(或其他类似的机制)发送通知。
这是如何在Win11 11/Win11 10上的powershell中完成的?
发布于 2022-03-16 08:12:06
我认为BurntToast模块就是您要寻找的内容:
用于显示Windows10和WindowsServer2019烤面包通知的PowerShell模块
下面是自述文件中的一个简单示例:
New-BurntToastNotification `
-AppLogo C:\smile.jpg `
-Text "Don't forget to smile!",
'Your script ran successfully, celebrate!'
结果:
发布于 2022-03-16 01:28:04
# this can be a manual input array of users as well
$users = ((Get-WMIObject -ClassName Win32_ComputerSystem).Username).Split('\')[1]
$WhatToSend = Read-Host "What do you want the message to be"
foreach ($user in $users){
& msg $user $WhatToSend
}
#if you want to send the message to all users then use a wildcard
msg * $WhatToSend
https://stackoverflow.com/questions/71490603
复制相似问题