Calling a protected Windows executable with Perl
- by Jake
I'm trying to write a perl script that determines which users are currently logged into Windows by using query.exe (c:\Windows\system32\query.exe). Perl is unable to access this file, unable to execute it, even unable to see that it exists, as I've found with the following code:
print `dir c:\\windows\\system32\\query*`;
This produces the following output:
07/13/2009 05:16 PM 1,363,456 Query.dll
1 File(s) 1,363,456 bytes
0 Dir(s) 183,987,658,752 bytes free
I've checked the user executing the script using perl's getlogin function, and it returns the name of a member of the local Administrators group (specifically, me). I've also tried adding read/execute permissions for "Everyone", but windows keeps giving me access denied errors when I try to modify this file's permissions. Finally, I've tried running perl.exe as an administrator but that doesn't fix the problem either.
Is this something I can solve by changing some settings in Windows? Do I need to add something to my perl script? Or is there just no way to grant perl access to some of these processes?