PowerShell -Psexec错误 [英] PowerShell -Psexec error

查看:186
本文介绍了PowerShell -Psexec错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



目前我尝试获取证书列表及其到期日期,但使用此代码:

 psexec \\ $ strComputer Get-ChildItem Cert:\ LocalMachine \ Myy 

我得到这个错误" 指定
找不到文件"


我没有得到它,因为当我登录计算机时,我可以执行此命令。


谢谢求助!





解决方案

您好Olluth,


p pxxec默认情况下不会运行PowerShell,而是将计算机名之后的第一个单词解释为要启动的可执行文件(并猜测,在它知道的任何地方都没有Get-ChildItem.exe)。


所以试试吧:

 psexec \\ 


strComputer powershell.exe -Command Get-ChildItem Cert:\ LocalMachine \ My

干杯,
Fred


Hello guys,

Currently I try to get the list of certificates and their expiration date but with this code:

psexec \\$strComputer Get-ChildItem Cert:\LocalMachine\My

I get this error "specified file not found"

I don't get it because when i'm logging on the computer I can execute this command.

Thanks for help !


解决方案

Hi Olluth,

psexec does not by default run PowerShell, but interprets the first word after the computername as the executable to launch (and guess what, there's no Get-ChildItem.exe anywhere it knows to look).

So try this instead:

psexec \\


strComputer powershell.exe -Command Get-ChildItem Cert:\LocalMachine\My

Cheers,
Fred


这篇关于PowerShell -Psexec错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆