The command runs in a Perl script when that script is run from a command prompt and not as a service. To run it as a service I am using the PDK and running perlsvc script.pl to create an executable and then installing that executable using script.exe -install. If I run script.exe from cmd it works fine when I run the service is when the rcmd command fails.