|
Answer» Dear all , Could you help me to make batch file to change some keys for network computers: All PCs joined Domain and i have an account to login into any PC after that I can access to any PC via Regedit than connect to remote registry but i want to make batch file to do that in one transaction and i want to make the computer name is a variable: -Path and values that I want to change is the path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon Name Type Data AutoAdminLogon REG_SZ 1 DefaultUserName REG_SZ EMO Defaultpassword REG_SZ 123456
Note: all values just are Example. -If any one can help me please don't hesitate to do that and if anyone can make such as this batch file and send it to me also please don't be late to help thanks all for your listening to meCan you test this on a test machine? You will need to run it as admin.
Code: [Select]@echo off set machine=192.168.0.100 set "key=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" reg \\%machine%\"%key%" /v AutoAdminLogon /t REG_SZ /d 1 /f reg \\%machine%\"%key%" /v DefaultUserName /t REG_SZ /d EMO /f reg \\%machine%\"%key%" /v Defaultpassword /t REG_SZ /d 123456 /f @echo off set machine=192.168.0.100 set "key=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" reg \\%machine%\"%key%" /v AutoAdminLogon /t REG_SZ /d 1 /f reg \\%machine%\"%key%" /v DefaultUserName /t REG_SZ /d EMO /f reg \\%machine%\"%key%" /v Defaultpassword /t REG_SZ /d 123456 /f
Dear foxidrive
Firstly: thanks for your appreciation and I will use your batch. Secondly: And I'm sorry for my MISS understanding for these parameters could you please explain these parameters to me ( /v , /t , /d and /f ) and why you don't use REG ADD instead REG only as i saw before and if tried to use this batch it's will overwrite the keys already EXIST or what? - Can I use a variable as i want without editing in my batch every time - Could you explain this to me by details every steps So that I can later develop myself in this batch language. I'm so sorry again for your Inconvenience i'm just beginnerWow...Abo-Zead, The blue font color is really starting to get annoying. In my opinion you should only use color to draw attention to a specific phrase or sentence that is important. There is no need to make all of your post a DIFFERENT color. Please keep it to the default black.Quote from: Squashman on August 19, 2015, 02:05:24 PM Abo-Zead, The blue font color is really starting to get annoying. In my opinion you should only use color to draw attention to a specific phrase or sentence that is important. There is no need to make all of your post a different color. Please keep it to the default black.
Dear Squashman,
I'm so sorry for your annoyance I did not mean that and I will take your advice in the next times. And If any one can help me please don't hesitate to explain the previous Post.Yes, it does need 'add' in each reg command - and will overwrite existing INFO, if I understood the help correctly.
Code: [Select]@echo off set machine=192.168.0.100 set "key=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" reg add \\%machine%\"%key%" /v AutoAdminLogon /t REG_SZ /d 1 /f reg add \\%machine%\"%key%" /v DefaultUserName /t REG_SZ /d EMO /f reg add \\%machine%\"%key%" /v Defaultpassword /t REG_SZ /d 123456 /f
You will have to test it on a machine to confirm that it works before it can be modified, and also explain how you are getting the IP address of the machines - so the appropriate modifications can be made.
Quote from: foxidrive on August 20, 2015, 04:04:23 AMYes, it does need 'add' in each reg command - and will overwrite existing info, if I understood the help correctly.
Code: [Select]@echo off set machine=192.168.0.100 set "key=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" reg add \\%machine%\"%key%" /v AutoAdminLogon /t REG_SZ /d 1 /f reg add \\%machine%\"%key%" /v DefaultUserName /t REG_SZ /d EMO /f reg add \\%machine%\"%key%" /v Defaultpassword /t REG_SZ /d 123456 /f
You will have to test it on a machine to confirm that it works before it can be modified, and also explain how you are getting the IP address of the machines - so the appropriate modifications can be made.
Ok, foxidrive
I'll test this may be today or tomorrow and feedback you ASAP . but i think we can using the Hostname instead the IP and can use set "k=" , SET /P "K= and IF /i %K%== conditions to make the IP or Hostname is variable . and i can't understand what the meaning of /v , /t , /d and /f can you explain We appreciate you for your effort to help me Quote from: Abo-Zead on August 20, 2015, 07:41:05 AMbut i think we can using the Hostname instead the IP and can use set "k=" , SET /P "K= and IF /i %K%== conditions to make the IP or Hostname is variable .
Hostname should work - but are you typing in each hostname from the keyboard?
Quote and i can't understand what the meaning of /v , /t , /d and /f can you explain
In a cmd prompt type reg add /? and read the help and examples. If there is something you can't figure out then discuss which part you don't understand. Quote from: foxidrive on August 20, 2015, 09:15:41 AMHostname should work - but are you typing in each hostname from the keyboard?
In a cmd prompt type reg add /? and read the help and examples. If there is something you can't figure out then discuss which part you don't understand.
Hi foxidrive,
I have modified the Batch file as my requirements and when tested it gives me an error" invalid key name" and here is the final batch attached if you want to look and edit and the result.
[attachment deleted by admin to conserve space]It requires the double quoting around the entire first term, not just %key% where I had put it.
Test this on a non-critical machine.
Code: [Select]@echo off set machine=cai3c332 set "key=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" reg add "\\%machine%\%key%" /v AltDefaultDomainName /t REG_SZ /d CAI /f reg add "\\%machine%\%key%" /v AltDefaultUserName /t REG_SZ /d muslogon /f reg add "\\%machine%\%key%" /v AutoAdminLogon /t REG_SZ /d 1 /f reg add "\\%machine%\%key%" /v DefaultDomainName /t REG_SZ /d CAI /f reg add "\\%machine%\%key%" /v DefaultPassword /t REG_SZ /d esumiac /f reg add "\\%machine%\%key%" /v DefaultUserName /t REG_SZ /d muslogon /f reg add "\\%machine%\%key%" /v ForceAutoLogon /t REG_SZ /d 1 /f pauseQuote from: foxidrive on August 21, 2015, 04:10:38 PMIt requires the double quoting around the entire first term, not just %key% where I had put it.
Test this on a non-critical machine.
Code: [Select]@echo off set machine=cai3c332 set "key=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" reg add "\\%machine%\%key%" /v AltDefaultDomainName /t REG_SZ /d CAI /f reg add "\\%machine%\%key%" /v AltDefaultUserName /t REG_SZ /d muslogon /f reg add "\\%machine%\%key%" /v AutoAdminLogon /t REG_SZ /d 1 /f reg add "\\%machine%\%key%" /v DefaultDomainName /t REG_SZ /d CAI /f reg add "\\%machine%\%key%" /v DefaultPassword /t REG_SZ /d esumiac /f reg add "\\%machine%\%key%" /v DefaultUserName /t REG_SZ /d muslogon /f reg add "\\%machine%\%key%" /v ForceAutoLogon /t REG_SZ /d 1 /f pause Yes, MR foxidrive it's WORKING now many many thanks for your great effort with me.
thank
|