Solved

Batch File Program

Posted on 2011-03-25
9
504 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 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 3

Author Comment

by:venkatspb
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 2

Expert Comment

by:edzhu
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks
0
 
LVL 10

Expert Comment

by:ReneGe
Comment Utility
Glad i'v helped.

Cheers,
Rene
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now