[VB.NET] Modify a reg key

Discussion in 'Mixed Languages' started by BaWFrAgOr, Apr 5, 2012.

  1. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    #1 BaWFrAgOr, Apr 5, 2012
    Last edited by a moderator: Apr 20, 2017
    Hello,
    i would like to modify this key
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlateform\Activation

    NotificationDisabled

    Pass the value to 1
    To try that, my soft drop and lauch the regkey

    this is the containt
    Windows Registry Editor Version 5.00
    Code:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Activation]
    "NotificationDisabled"=dword:1
    But it doesn't work :'( and if i lauch manualy the key, it work.
    Why ? Thanks
     
  2. NICK@NUMBER11

    NICK@NUMBER11 MDL Expert

    Mar 23, 2010
    1,354
    631
    60
    how are you calling it?
     
  3. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    #3 BaWFrAgOr, Apr 5, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Hello,
    thanks for your help :

    Code:
    
    File.WriteAllText("C:\KeyName.reg", My.Resources.KeyNameInMyRessource)' Write my key on C: 
    Process.Start("C:\KeyName.reg") ' Open my key
     
  4. stevemk14ebr

    stevemk14ebr MDL Senior Member

    Jun 23, 2010
    267
    48
    10
    #5 stevemk14ebr, Apr 6, 2012
    Last edited by a moderator: Apr 20, 2017
    here is how i did it in my ahci changer app (this is an exerpt)
    Code:
      Dim autoshell = My.Computer.Registry.LocalMachine.OpenSubKey("System\CurrentControlSet\Services\msahci", True)
                                '' Set the value to 0
                                autoshell.SetValue("Start", 0)
                                autoshell.Close()
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    5,864
    20,048
    180
    #6 Alphawaves, Apr 6, 2012
    Last edited by a moderator: Apr 20, 2017
    Simple method =
    Code:
     My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Activation", "NotificationDisabled", 1)
    I prefer an auto method, if 0 then will change to 1 and vice versa:
    Code:
    Try
                Dim Lm As RegistryKey = Registry.LocalMachine
                Dim Notification As RegistryKey = Lm.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Activation", RegistryKeyPermissionCheck.ReadWriteSubTree, Security.AccessControl.RegistryRights.SetValue Or Security.AccessControl.RegistryRights.QueryValues)
                Dim Enabled As Nullable(Of Integer) = CType(Notification.GetValue("NotificationDisabled"), Nullable(Of Integer))
                If Enabled <> 1 Then
                    Notification.SetValue("NotificationDisabled", 1, RegistryValueKind.DWord)
                Else
                    Notification.SetValue("NotificationDisabled", 0, RegistryValueKind.DWord)
                End If
            Catch ex As Exception
                MsgBox("Error: " & ex.Message)
            End Try
    ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    @stevemk14ebr and @Alphawaves
    Thanks for your help, your solutions work perfectly, the problem is that my Windows 7 was activated, so the notifications key wasn't can't modified ! :)
    Switch the post in solved
    Bye Bye !
     
  7. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    5,864
    20,048
    180
    Changing the notifications should'nt be a problem, just make sure you have Admin rights..;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...