Click here to Skip to main content
15,880,503 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is there a source code download for this article? Pin
Richard Deeming20-May-16 11:28
mveRichard Deeming20-May-16 11:28 
GeneralRe: Is there a source code download for this article? Pin
Member 1253641620-May-16 11:32
Member 1253641620-May-16 11:32 
AnswerRe: Is there a source code download for this article? Pin
Richard Deeming20-May-16 11:33
mveRichard Deeming20-May-16 11:33 
JokeRe: Is there a source code download for this article? Pin
Member 1253641620-May-16 20:01
Member 1253641620-May-16 20:01 
Questiondelete directory / folder recursive, by pass locked files Pin
jkirkerx20-May-16 10:53
professionaljkirkerx20-May-16 10:53 
AnswerRe: delete directory / folder recursive, by pass locked files Pin
Member 244330620-May-16 11:50
Member 244330620-May-16 11:50 
GeneralRe: delete directory / folder recursive, by pass locked files Pin
jkirkerx20-May-16 12:30
professionaljkirkerx20-May-16 12:30 
AnswerProblem 2, access the HKLM as Admin doesn't work Pin
jkirkerx20-May-16 12:36
professionaljkirkerx20-May-16 12:36 
Guess my idea to just write a program to disable win10 upgrades was not a good idea.
Just FYI, the 2nd key is what the group policy does from what I read.

I can't access the LocalMachine Key, I just get a null back.
I did the click run as administrator.
Logged in as administrator.

I really don't want to manually adjust every computer in the office.
Guess Microsoft really tightened up the security which is good.
public static bool tweak_registry()
{
    bool pValue = false;
    const string subKey1 = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade";
    const string keyName1 = "AllowOSUpgrade";
    const string keyName2 = "DisableOSUpgrade";

    try
    {
        using (var _key = Registry.LocalMachine.OpenSubKey(subKey1, true))
        {
            // Set the value for AllowOSUpgrade to false or Dword 0
            _key.SetValue(keyName1, 0, RegistryValueKind.DWord);
            _key.SetValue(keyName2, 1, RegistryValueKind.DWord);
        }

        pValue = true;
    }
    catch (Exception ex)
    {
        pValue = false;
        if (ex.Message == "Attempted to perform an unauthorized operation.")
        {
            Console.WriteLine("");
            Console.WriteLine("You must be an adminsitrator to perform this task!");
            Console.WriteLine("Right Click on the program and select 'Run as Administrator'");
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
            System.Environment.Exit(-1);
        }
        else
        {
            Console.WriteLine("ERROR: " + ex.Message);
            Console.ReadKey();
        }

    }            

    return pValue;
}

GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
Member 244330620-May-16 12:53
Member 244330620-May-16 12:53 
GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
jkirkerx21-May-16 12:00
professionaljkirkerx21-May-16 12:00 
GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
jkirkerx22-May-16 7:28
professionaljkirkerx22-May-16 7:28 
AnswerRe: delete directory / folder recursive, by pass locked files [done] Pin
jkirkerx22-May-16 7:31
professionaljkirkerx22-May-16 7:31 
GeneralRe: delete directory / folder recursive, by pass locked files [done] Pin
Member 244330622-May-16 9:14
Member 244330622-May-16 9:14 
QuestionDotnetbar in C# Pin
Member 1051156220-May-16 1:18
Member 1051156220-May-16 1:18 
AnswerRe: Dotnetbar in C# Pin
Pete O'Hanlon20-May-16 1:42
mvePete O'Hanlon20-May-16 1:42 
JokeRe: Dotnetbar in C# Pin
Richard Deeming20-May-16 1:57
mveRichard Deeming20-May-16 1:57 
AnswerRe: Dotnetbar in C# Pin
Richard MacCutchan20-May-16 1:49
mveRichard MacCutchan20-May-16 1:49 
Questiontrouble with combobox and datagridviews Pin
Simon_Whale20-May-16 1:08
Simon_Whale20-May-16 1:08 
AnswerRe: trouble with combobox and datagridviews Pin
U. G. Leander20-May-16 1:37
professionalU. G. Leander20-May-16 1:37 
QuestionC# How to Copy Files of the same extension from One Server to multiple Servers on the same network simultaneously Pin
Member 1253400819-May-16 23:35
Member 1253400819-May-16 23:35 
AnswerRe: C# How to Copy Files of the same extension from One Server to multiple Servers on the same network simultaneously Pin
Pete O'Hanlon19-May-16 23:54
mvePete O'Hanlon19-May-16 23:54 
GeneralRe: C# How to Copy Files of the same extension from One Server to multiple Servers on the same network simultaneously Pin
Member 1253400820-May-16 0:38
Member 1253400820-May-16 0:38 
GeneralRe: C# How to Copy Files of the same extension from One Server to multiple Servers on the same network simultaneously Pin
Pete O'Hanlon20-May-16 1:00
mvePete O'Hanlon20-May-16 1:00 
GeneralRe: C# How to Copy Files of the same extension from One Server to multiple Servers on the same network simultaneously Pin
Member 1253400820-May-16 4:25
Member 1253400820-May-16 4:25 
GeneralRe: C# How to Copy Files of the same extension from One Server to multiple Servers on the same network simultaneously Pin
Member 1253400823-May-16 0:22
Member 1253400823-May-16 0:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.