Sign in to follow this  
Followers 0
ScriptFu

psexec working on one machine and not another

11 posts in this topic

I have a script which opens up a rdc remotely on a Windows 7 machine using psexec.

It works perfectly on one machine, but does not work at all on the other which is using the same OS (Win 7).

Anyone has this happen to them? The second machine just does nothing when i execute the command to open the rdc.

Share this post


Link to post
Share on other sites



Hi, ScriptFu. How about posting your code so we can take a look? :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I can't put too much due to privacy, but this is the function which i have been using.

Func _remoteLaunch($remoteIp, $path, $username)

RunWait(@ComSpec & " /c " & "C:\pstools\psexec.exe \\" & $remoteIp & ' -u ' & $username & ' -p password -d -i 1 -w c:\windows\system mstsc "' & $path & '" /admin ')

EndFunc

and here is how i call it:

Case $button

_remoteLaunch($Ip, "c:\Users\User\Desktop\rdp.RDP", "User")

Share this post


Link to post
Share on other sites

So what do you see if you change the '/c" to "/k" to keep the window open? Any errors?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

My first question would be............ ;)

The computer that's not working, is the remote management service running?

run the "winrm quickconfig" and see if you get better results. If the machine is already configured, no harm no foul.

Edited by Colyn1337

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Under some circumstances you should use the parameter '-accepteula' for psexec !?

Edited by Michahe

Share this post


Link to post
Share on other sites

So what do you see if you change the '/c" to "/k" to keep the window open? Any errors?

Thanks for this.

I see 'Logon Failure: unknown user name or bad password'

I know for a fact that i have the right username and password however.

Share this post


Link to post
Share on other sites

Thanks for this.

I see 'Logon Failure: unknown user name or bad password'

I know for a fact that i have the right username and password however.

I have sorted out the bad credentials issue, it was a problem with the function parameters.

The error i now receive is 'invalid connection file ("path") specified'.

Thoughts?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

RunWait(@ComSpec & " /c " & "C:pstoolspsexec.exe " & $remoteIp & ' -u ' & $username & ' -p password -d -i 1 -w c:windowssystem mstsc "' & $path & '" /admin ')

Take a look at what you have for the path to mstsc, you stop at C:windowssystem. You should be calling C:WindowsSystem32mstsc.exe (or SysWOW64 if your box is 64-bit).

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Take a look at what you have for the path to mstsc, you stop at C:windowssystem. You should be calling C:WindowsSystem32mstsc.exe (or SysWOW64 if your box is 64-bit).

It now gives me 'cant access: specified path invalid'

Indeed it is a X64 machine.

Share this post


Link to post
Share on other sites

It works!!!!

It was a stupid typo in the file name with 2 spaces instead of one.

Thanks a lot guys!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0