powershell - 运行 powershell 脚本,以便检查并邮寄故障
问题描述
我正在运行一个包含许多成员的 Office 365 数据库,每个成员都在一组组中。我曾经手动检查组和用户,但现在成员太多,无法有效地做到这一点。现在我在 github 上的某个地方找到了一个 powershell 脚本,但它看起来好像只是在 powershell 中进行检查和显示。有没有办法让脚本比较用户和组,如果用户在组中,他不属于向域中的管理员邮件发送邮件?如果这有任何意义...
解决方案
您可以使用这段代码在 powershell 中发送电子邮件。
$smtpServer = "mailserver.com"
$From = "from@mailserver.com"
$To = "to@example.com"
$Subject = "example"
$body = "test"
send-mailmessage -to $To -from $From -subject $Subject -SmtpServer $smtpServer -Body $body -BodyAsHtml -Port 25
推荐阅读
- laravel - 雄辩的关系插入/创建祖父母ID
- validation - 动态字段验证消息问题
- mysql - MYSQL:SELECT 1 from table1 where Id = 1 vs SELECT EXISTS(SELECT 1 from table1 where Id = 1)
- postgresql - Postgres:使用提取大小进行事务隔离
- oracle11g - oracle 中是否有临时可用的内置表或表空间?
- javascript - 无法在所有画布上上传图像
- android - RecyclerView 将图像设置在错误的位置
- javascript - 使用 VSCode 将常量重构为惰性常量
- arrays - 如何在反应表的行中呈现数组数据
- java - RestTemplate 与自定义 ConnectionPool?