1

When copying the .exe to a 64bit Windows computer using the -c flag with PsExec, there's an error executing it, PsExec just stalls there.

Anyone else experiencing this?

Luca Matteis
  • 548
  • 4
  • 11
  • 21

2 Answers2

1

Is this thread on social.msdn relevant?

The poster was getting problems with PsExec on some 64 bit machines, but was getting a "... device not functioning..." message. However, in his own reply he states:

After some more testing I noticed the problem only occurred on WES 7 64 Bit.
Any retail version 32 or 64 bit and WES 7 32 bit would work fine.
Then I remembered the following update:
KB982199 is an update for 64-bit systems which fixes the following issue: CreateProcess fails for 32 bit Applications on Windows Embedded Standard 7 64-bit runtimes when redirection disabled
After installing this update the problem was solved.

ChrisF
  • 1,871
  • 1
  • 21
  • 28
  • Hrm, my stalling issue is happening on Windows Vista 64 bit computers as well :(... when i try to run the .exe that it copies inside system32 I get an error. If however i copy and paste that .exe somewhere else and run it, it works. – Luca Matteis Aug 20 '10 at 14:48
  • @Luca - I haven't been able to find out whether KB982199 applies to Vista or not. The description just says "64-bit". – ChrisF Aug 20 '10 at 15:00
  • `%Windir%\system32` is a protected directory with UAC on and configured a certain way, I know it is hard to elevate, I assume you are using an admin account on the target machine, but how is UAC configured? Can you use psexec with that account to echo to a blank text file? Also keep in mind 64-bit Windows means [SysWoW64](http://forums.techarena.in/windows-x64-edition/1189266.htm), meaning folder redirection and other nastiness that makes accessing important system directories less trivial than before, because the context in which you, read, write, or execute from it changes what it is. – songei2f Jun 12 '11 at 06:19
0

const string subkey = "Software\Sysinternals\PsExec";

        if (Environment.Is64BitOperatingSystem)
        {
            // For 64 Bit PC
            RegistryKey registryKey64 = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
            RegistryKey NDPKey64 = registryKey64.OpenSubKey(subkey);
            if (NDPKey64 != null)
            {
                Registry.CurrentUser.OpenSubKey(subkey, true).SetValue("EulaAccepted", 1, RegistryValueKind.DWord);
            }
            else
            {
                RegistryKey regKey64 = registryKey64.OpenSubKey("Software", true);
                regKey64.CreateSubKey("Sysinternals\\PsExec", RegistryKeyPermissionCheck.ReadWriteSubTree);
                Registry.CurrentUser.OpenSubKey(subkey, true).SetValue("EulaAccepted", 1, RegistryValueKind.DWord);
            }
        }
        else
        {
            //For 32 bit PC
            RegistryKey registryKey32 = Registry.CurrentUser.OpenSubKey(subkey);
            if (registryKey32 != null)
            {
                Registry.CurrentUser.OpenSubKey(subkey, true).SetValue("EulaAccepted", 1, RegistryValueKind.DWord);
            }
            else
            {
                RegistryKey regKey32 = Registry.CurrentUser.OpenSubKey("Software", true);
                regKey32.CreateSubKey("Sysinternals\\PsExec", RegistryKeyPermissionCheck.ReadWriteSubTree);
                Registry.CurrentUser.OpenSubKey(subkey, true).SetValue("EulaAccepted", 1, RegistryValueKind.DWord);
            }
        }
Shyam
  • 1
  • 1
    What on earth is this? – Michael Hampton Nov 27 '12 at 13:03
  • Ok, sometimes the PsExec eventhough it is installed wont invoke other exes when requested. The problem is to do with setting the EulaAccepted DWORD value to 1. I could not find a page which discusses this problem, so added here. – Shyam Nov 30 '12 at 09:19
  • That's great, and it might be a useful answer, but this appears to be code. Why didn't you just say "change this registry entry"? – Michael Hampton Nov 30 '12 at 12:42