繁体   English   中英

Powershell 在 ISE 中运行脚本完整 window

[英]Powershell run Script in ISE full window

是否有一个 Powershell 脚本从调度程序启动并运行完整的 ISE window 并在完成后关闭。 我正在使用 ZeeDrive 到 map 和 SharePoint 驱动器,但在调度程序中运行脚本,它看不到驱动器。 然而,如果我在 ISE 中打开并运行,它会发现它很好。 我从 ThinkScape 得到的回报:

'Zee Drive 需要在 Windows session 中运行。 It is designed for end users – if it is running as a service, or “headless” ie no Windows session, or being accessed from a different Windows session it won't work. 我们不支持作为服务运行的 Zee Drive 或服务类型的工作负载——它是为处理文档的最终用户而设计的。

任何帮助将不胜感激。 谢谢

我能想到的唯一方法是将您的脚本添加到Microsoft.PowerShellISE_profile.ps1 ,然后使用调度程序和您的文件作为参数启动 ISE,如下所示:

powershell_ise .\Check-Process.ps1

在您的个人资料中,您需要确保该脚本仅在您打开该文件时运行:

if($psISE.PowerShellTabs.Files.FullPath -eq '\\fileserver\path$\to\my\Powershell\Check-Process.ps1')
{
    & '\\fileserver\path$\to\my\Powershell\Check-Process.ps1'
}

但要小心! 除非您使用开关-noprofile ,否则每次在 ISE 中打开该脚本时都会运行该脚本。

到目前为止,我还没有找到使用配置文件脚本关闭 ISE window 的方法。

暂无
暂无

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

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