[英]Powershell script works in ISE but not in Run With Powershell
[英]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.