[英]VBScript will not run from Powershell script that runs from Windows Task Scheduler
[英]How to check in PowerShell if the script was run in background (e.g. Windows Task Scheduler) or in user session
如果脚本在后台运行(例如通过 Windows 任务计划程序)或在用户会话中,如何检查 PowerShell
在脚本内部(当脚本运行时)你可以使用 $host.name
if ($host.name -match 'ise') {"Do not send mail.."}
if ($host.name -match 'console') {Send-mail...}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.