Probably it's an issue of missing access rights in regard to the user and/or the network. The easiest test will be to run the script within the desktop client on the server machine with the user who runs the services.
Beside this the server and the desktop client should always have the same release. Mixing them up might cause strange effects ...