Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Batch File Program

Posted on 2011-03-25
9
Medium Priority
?
514 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
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Accepted Solution

by:
thomas_nilsson earned 375 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 375 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 375 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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
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 375 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 learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

971 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