Jump to content
antonioj84

RegWrite Issues

Recommended Posts

antonioj84

Hi all to the forum guru and expert I am trying to  automate this. in the registry  I have the network profile name network 2 and network   I want to  change their  CATEGORY  to Private .  Can someone lead me in the right direction.

Private is 1 and Public is 0

#RequireAdmin

Global $sHKLMRoot = @OSArch = "x64" ? "HKLM64" : "HKLM"


RegWrite($sHKLMRoot &"\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" ,'/v NetworkList /t REG_MULTI_SZ /d 00000000 /f')

see  attached picture below

Much appreaciate

 

registry.JPG

Edited by antonioj84

Share this post


Link to post
Share on other sites
xCROv

This topic over almost a year old and it doesn't look like you're really adding anything to it directly. It's prob best if you start your own topic.

 

You should follow the examples in this thread and read the regwrite function.

Share this post


Link to post
Share on other sites
Subz

As xCROv mentioned you should create a new thread and read the help file on RegWrite you will see your syntax is incorrect also you would need to use RegEnumKey, if you create a new post, I'll be happy to assist with your query.

 

Share this post


Link to post
Share on other sites
antonioj84

Thanks  Subz, and DanyFirex  Regnumkey was they key ingredient. If this can help someone else here is the code below 

#include <MsgBoxConstants.au3>
#RequireAdmin

Local Const $sHKLMRoot = @OSArch = "x64" ? "HKLM64" : "HKLM"

$iCategoryPrivate = 1
$iCategoryPublic = 0



Local $sSubKey =""
For $i =  1 To 2

$sSubKey = RegEnumKey($sHKLMRoot & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles", $i)
If @error Then ExitLoop




MsgBox($MB_SYSTEMMODAL, "SubKey #" & $i & " SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles: ", $sSubKey)


$sRegNetworkName = RegRead($sHKLMRoot & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\" & $sSubKey, "ProfileName")


 MsgBox($MB_SYSTEMMODAL, "Profile #" & $i & " SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles: ", $sRegNetworkName)


$Category = Int(RegRead($sHKLMRoot & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\" & $sSubKey, "Category"))


MsgBox($MB_SYSTEMMODAL, "Category #" & $i & " SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles: ", $Category)

;now you can write the key using regwrite to make category private or public
;~ RegWrite($sHKLMRoot & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\" & $sSubKey, "Category", "REG_DWORD", $iCategoryPrivate)


Next

 

Share this post


Link to post
Share on other sites
Subz

I would normally write it this way, so you're not limited by multiple network connections

#RequireAdmin
Local $sHKLM = @OSArch = 'x64' ? 'HKLM64' : 'HKLM'
Local $sMainKey = $sHKLM & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles", $sSubkey, $i = 1
Local $iCategoryPrivate = 1, $iCategoryPublic = 0
While 1
    $sSubkey = RegEnumKey($sMainKey, $i)
        If @error Then ExitLoop
    If RegRead($sMainKey & "\" & $sSubkey, "ProfileName") = "Network" Then
;~      Uncomment line below to change category
;~      RegWrite($sMainKey & "\" & $sSubkey, "Category", "REG_DWORD", $iCategoryPrivate)
    ElseIf RegRead($sMainKey & "\" & $sSubkey, "ProfileName") = "Network 2" Then
;~      Uncomment line below to change category
;~      RegWrite($sMainKey & "\" & $sSubkey, "Category", "REG_DWORD", $iCategoryPrivate)
    EndIf
    $i += 1
WEnd
  • Thanks 1

Share this post


Link to post
Share on other sites
antonioj84

jologan3013 , xcrov already make that point please what else are you adding. I don't think a year old is that old after all. Are you able to move it to a new Topic ?

Edited by antonioj84
errorh

Share this post


Link to post
Share on other sites
JLogan3o13

The old topic was a year old; I have split your intrusion into its own topic. What I am adding is that you need to create your own topics so someone from the Moderating team does not have to spend 20 minutes splitting them out.

Edited by JLogan3o13
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Elrond5
      By Elrond5
      So I want to remap Capslock to Ctrl using Autoit
      ;3A00 = Caps ;1D00 = Ctrl RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout","Scancode Map","REG_BINARY","000000000000000002000000E0473A0000000000") However it isn't doing anything. And I have no idea why my code doesn't work.
    • ur
      By ur
      When I compiled my script or any script to exe using 32 bit compiler and ran on 32 bit machine, I am getting below error.
       

       
      But it is 32 bit only.
       
      And, for testing, I disabled smart screen also, but same issue.
      Please suggest.
       
    • sadakathullah
      By sadakathullah
      Hi All, I am new to AutoIT and exploring options to use it in my organization. I tried couple of examples and it is fantastic. I am trying to run restrictions test in a pc to see if certain options are disabled like print screen, mstsc etc. I could not get a hang of it. Any help is much appreciated.
    • stayready40
      By stayready40
      Hello all. I created a script to uninstall Symantec from our environment and I placed the "BlockInput(1)" command in the beginning of the script so that end users would not be able to move the mouse or keyboard to disrupt the mouse clicks.
      During testing we found that this worked for our Windows 7 machines, but for our windows 10 machines the mouse disable did not work can anyone shed some light on why this is? 
      Here is my code:

       
    • faustf
      By faustf
      hi guys
      i have a script  like this,  in windows 7 work perfect , in windows 10 not  work  , some one can explain me  why ??'
      #include <Array.au3> #include <MsgBoxConstants.au3> Global $aGPathFoto= FileReadToArray (@ScriptDir & "\TEMP\PathFoto.txt") Local $ctrl = 0 While 1 Local $hWnd = WinWait("[CLASS:#32770]", "", 10) If WinExists("[CLASS:#32770]") Then If $ctrl < 2 Then ControlSend($hWnd, "Choose File to Upload", "[CLASS:Edit; INSTANCE:1]", $aGPathFoto[0]&"{Enter}") Exit $ctrl += 1 Else ExitLoop EndIf EndIf WEnd $aGpathfoto = C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg
×