Solved

Batch File Program

Posted on 2011-03-25
9
511 Views
Last Modified: 2012-05-11
I want to Write a  batch file to change a few settings in group policy, if it is possbile then please let me know the basic program to write a bath file?
0
Comment
Question by:venkatspb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Accepted Solution

by:
thomas_nilsson earned 125 total points
ID: 35213633
To write a batch file you can use any texteditor. A batch file is just a textfile with file extension ".bat", so Notepad would do if you remember to save it with the correct extension. Or rename the file afterwards.

But maybe that was not your question?
0
 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 125 total points
ID: 35213698
Your batch file would look like commands you would type in the COMMAND PROMPT, such as

CD C:\YourFolder
Rename YourFile.txt "Your File.txt"
RunProgram.exe
Exit

Notice the quotes around "Your File.txt".  This is necessary if you have spaces in file titles.
The EXIT at the end closes the command prompt session.

You can use notepad for the editor.  Save or rename to .bat when finished.
You can create a Windows Shortcut to this file if you like.

Scott C


0
 
LVL 2

Assisted Solution

by:edzhu
edzhu earned 125 total points
ID: 35214813
I don't think using batch file is a good idea to modify the group policy. I recommend you to use the vbscript to do so. If you want to repeat change some value, you can write a small vbscript for one item and then write a batch file to call this vbscript repeatedly.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 3

Author Comment

by:venkatspb
ID: 35220892
Dear edzhu,

Thanks very much for your suggestion. I want to disable the usb and wireless devices in the laptop. Is is possible to write a script for that? If so please suggest me the code. Thanks.

Thanks,
Venkat
0
 
LVL 2

Expert Comment

by:edzhu
ID: 35221083
Venkat,

For the detail problem, I think the following two articles will be helpful to you. It provides you a solution to disable the usb device.
http://support.microsoft.com/kb/555324
http://badzmanaois.blogspot.com/2008/09/disable-usb-storage-using-vbs-script_07.html
I am not sure about the wireless. But I think it is same.
0
 
LVL 3

Author Comment

by:venkatspb
ID: 35229121
Dear edzhu,

Could u pls write a VBscript for changing the group policy state from not configuring to disable.

for eg: (in windows 7)

run->gpedit.msc->Computer configuration->Adminstrative templates-> windows components->Remote Desktop Services->Remote Desktop Session Host-> Connection->Allow user to connect remotely using Remote Desktop Services..... -> want to make not configured to enable),

and also in same prog want to change

 run->gpedit.msc->Computer configuration->Adminstrative templates-> windows components->Remote Desktop Services->Remote Desktop Session Host-> Security->Allow user to connect remotely using Remote Desktop Services..... -> want to make not configured to enable)

and

run-> gpupdate /force.

Adv many thnks

regards
Venkat


0
 
LVL 10

Assisted Solution

by:ReneGe
ReneGe earned 125 total points
ID: 35302753
Why not just making a batch file to directly change the PC's registry "fdenyaccess" to 0?

Cheers,
Rene
 
@ECHO OFF

REM ASSUMING THAT ALL PCs STARTS WITH \\PC

SETLOCAL enabledelayedexpansion

IF EXIST "%~N0.log" DEL "%~N0.log" >NUL

FOR /F %%A IN ('net view ^| Findstr -i "\\XP"') DO (
	ECHO ENABLING RDP ON: %%A
	REG add "%%A\HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t reg_dword /d "0" /f
	IF !errorlevel! NEQ 0 ECHO %date% %time% ERROR:%%A>>%~N0.log
)

PAUSE
EXIT

Open in new window

0
 
LVL 3

Author Closing Comment

by:venkatspb
ID: 35413655
Thanks
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 35413657
Glad i'v helped.

Cheers,
Rene
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question