Jump to content

DLLCall on remote machine


notta
 Share

Recommended Posts

Do you guys know why a DllCall or a WinAPI call will not work on a remote machine using psexec? For example, I used the following code:

I have used psexec many, many times in the past, but never with a dllcall. If I run the script on the machine itself it works perfectly. I checked for @error on the dllcall, but @error was not set. Any help you guys can provide would be appreciated. Thanks.

Edited by notta
Link to comment
Share on other sites

I modified the "_ScreenSaverSet" function call to trap the error code and it was 1 (path not found) although I also added a FileExists() check before the call...if the file did not exist (which it does), then the script would exit with an odd error code number. It never exited on that error code, however, so the FileExists() call found the file, but the one function, for whatever reason, does not. It obviously did not set the screen saver to the remote machine, but it does if run locally. I tested it on Windows 7, both 32 & 64 bit, so it is not the script it is the script running remotely.

Link to comment
Share on other sites

I tested it on Windows 7, both 32 & 64 bit, so it is not the script it is the script running remotely.

Yes it seems that way. I was 95% of the way done working on a script for work, but without being able to refresh the timeout I'll have to scrap it completely. If a machine stays up for a month, it doesn't do me any good to just set the registry for next logon.

Are API calls system wide or user specific? I mean since I'm pushing it with psexec is it setting the screensaver timeout for my account on the remote machine or is it for whoever is logged into the machine?

Link to comment
Share on other sites

Yes it seems that way. I was 95% of the way done working on a script for work, but without being able to refresh the timeout I'll have to scrap it completely. If a machine stays up for a month, it doesn't do me any good to just set the registry for next logon.

Are API calls system wide or user specific? I mean since I'm pushing it with psexec is it setting the screensaver timeout for my account on the remote machine or is it for whoever is logged into the machine?

Here are a few notes that I have found with this script

From x64 to remote x86

psexec \\SERVER -i -c -f -w C:\ "SetSceenSaver.exe"
With this command, I can set the screen saver but the timeout does not change

psexec \\SERVER -s -i -c -f -w C:\ "SetSceenSaver.exe"
OR

psexec \\SERVER -u AdminAccount -p password -i -c -f -w C:\ "SetSceenSaver.exe"
With these commands (system account or remote Admin account), I can set the timeout but the screen saver does not change

From x86 to remote x64:

The same applies, but if I leave out the interactive switch "-i", psexec never closes. When I have it there, a window pops up on the target x64 machine (unreadable). If I hit enter or close it, the same rules above apply. So this is defintely not a silent solution.

On both, I have not been able to set the Password protect remotely.

I only have 2 machines, so I cannot test x86 to x86, or x64 to x64.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...