I'm trying to run a simple query on network computers to get their Windows' version. This command runs, and returns expected results, when used from the command line:
psexec \\comp_name reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseId
but when run from Perl using:
system("psexec \\\\$comp_name reg query 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion' /v ReleaseId")
I get the error from REG ERROR: Invalid key name.
Considering that both commands are the same, I cannot figure out why I am getting an error when running it from Perl. My only assumption is the way it's resolving the quotes. Note that this problem persists regardless of whether I use system, exec, or ``
. Any suggestions?