Click here to Skip to main content
15,169,443 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is there a source code download for this article? Pin
Richard Deeming20-May-16 12:28
mveRichard Deeming20-May-16 12:28 
GeneralRe: Is there a source code download for this article? Pin
Member 1253641620-May-16 12:32
MemberMember 1253641620-May-16 12:32 
AnswerRe: Is there a source code download for this article? Pin
Richard Deeming20-May-16 12:33
mveRichard Deeming20-May-16 12:33 
JokeRe: Is there a source code download for this article? Pin
Member 1253641620-May-16 21:01
MemberMember 1253641620-May-16 21:01 
Questiondelete directory / folder recursive, by pass locked files Pin
jkirkerx20-May-16 11:53
professionaljkirkerx20-May-16 11:53 
AnswerRe: delete directory / folder recursive, by pass locked files Pin
Member 244330620-May-16 12:50
MemberMember 244330620-May-16 12:50 
GeneralRe: delete directory / folder recursive, by pass locked files Pin
jkirkerx20-May-16 13:30
professionaljkirkerx20-May-16 13:30 
AnswerProblem 2, access the HKLM as Admin doesn't work Pin
jkirkerx20-May-16 13:36
professionaljkirkerx20-May-16 13: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 13:53
MemberMember 244330620-May-16 13:53 
GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
jkirkerx21-May-16 13:00
professionaljkirkerx21-May-16 13:00 
GeneralRe: Problem 2, access the HKLM as Admin doesn't work Pin
jkirkerx22-May-16 8:28
professionaljkirkerx22-May-16 8:28 
AnswerRe: delete directory / folder recursive, by pass locked files [done] Pin
jkirkerx22-May-16 8:31
professionaljkirkerx22-May-16 8:31 
GeneralRe: delete directory / folder recursive, by pass locked files [done] Pin
Member 244330622-May-16 10:14
MemberMember 244330622-May-16 10:14 
QuestionDotnetbar in C# Pin
Member 1051156220-May-16 2:18
MemberMember 1051156220-May-16 2:18 
AnswerRe: Dotnetbar in C# Pin
Pete O'Hanlon20-May-16 2:42
mvaPete O'Hanlon20-May-16 2:42 
JokeRe: Dotnetbar in C# Pin
Richard Deeming20-May-16 2:57
mveRichard Deeming20-May-16 2:57 
AnswerRe: Dotnetbar in C# Pin
Richard MacCutchan20-May-16 2:49
mveRichard MacCutchan20-May-16 2:49 
Questiontrouble with combobox and datagridviews Pin
Simon_Whale20-May-16 2:08
professionalSimon_Whale20-May-16 2:08 
AnswerRe: trouble with combobox and datagridviews Pin
U. G. Leander20-May-16 2:37
professionalU. G. Leander20-May-16 2:37 
QuestionC# 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:35
MemberMember 1253400820-May-16 0: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'Hanlon20-May-16 0:54
mvaPete O'Hanlon20-May-16 0: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 1:38
MemberMember 1253400820-May-16 1: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 2:00
mvaPete O'Hanlon20-May-16 2: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 5:25
MemberMember 1253400820-May-16 5: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 1:22
MemberMember 1253400823-May-16 1: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.