2017-05-08 296 views
0

我在Win 7中安裝了telnet客戶端。現在我嘗試在PowerShell中運行它。我需要在遠程主機上運行命令ewfmgr d: -commit。我用如何在PowerShell中運行Windows Telnet客戶端?

Invoke-Command -ComputerName [MyComp] -scriptblock {cmd.exe /c "telnet"} 

但沒有任何反應。是否可以使用CMD運行telnet並傳輸參數(IP,用戶名,密碼,命令)?

我想也

Invoke-Command -Command {cmd.exe /c C:\Windows\System32\telnet.exe} 

& "C:\Windows\System32\telnet.exe" 

Invoke-Command -ScriptBlock {C:\Windows\System32\telnet.exe} 

我試圖做同樣的事情here

+2

沒有任何反應,如Telnet客戶端是交互的程序。它等待用戶輸入。 Telnet腳本很痛苦,你可以使用SSH嗎? – vonPryz

+2

如果您必須使用telnet,則至少應使用實際可腳本化的telnet客戶端,例如[PuTTY suite](https://www.chiark.greenend.org。)上的['plink'](https://the.earth.li/~sgtatham/putty/0.69/htmldoc/Chapter7.html#plink)英國/〜sgtatham /油灰/ latest.html)。 –

回答

0

你可以Invoke-Item從打開PowerShell中的telnet cliente像前:

Invoke-Item "C:\Windows\System32\telnet.exe" 

start-sleep 5