Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
616 views
in Technique[技术] by (71.8m points)

windows - PsExec Throws Error Messages, but works without any problems

So we are using PsExec a lot in our automations to install virtual machines, as we can't use ps remote sessions with our windows 2003 machines. Everything works great and there are no Problems, but PsExec keeps throwing errors, even every command is being carried out without correctly. For example:

D:oolspstoolspsexec.exe $guestIP -u $global:default_user -p $global:default_pwd -d -i C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command "Enable-PSRemoting -Force"

Enables the PsRemoting on the guest, but also throws this error message:

psexec.exe : 
Bei D:ScriptsVMwareVMware_Module5.ps1:489 Zeichen:29
+     D:oolspstoolspsexec.exe <<<<  $guestIP -u $global:default_user -p $global:default_pwd -d -i C:WindowsSystem32WindowsPowerShell
v1.0powershell.exe -command "Enable-PSRemoting -Force"
+ CategoryInfo          : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com


Connecting to 172.17.23.95...Starting PsExec service on 172.17.23.95...Connecting with PsExec service on 172.17.23.95...Starting C:Windows
System32WindowsPowerShellv1.0powershell.exe on 172.17.23.95...
C:WindowsSystem32WindowsPowerShellv1.0powershell.exe started on 172.17.23.95 with process ID 2600.

These kinds of error messages apear ALWAYS no matter how i use psexec, like with quotes, with vriables/fixed values, other flags, etc. Does anybody has an idea how i could fix this? It is not a real problem, but it makes finding errors a pain in the ass, because the "errors" are everywhere. Disabling the error messages of psexec at all would also help...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is because PowerShell sometimes reports a NativeCommandError when a process writes to STDERR. PsExec writes the infoline

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

to STDERR which means it can cause this.

For more information, see these questions / answers:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...