`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);
}
}`