Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Batch File Program

Posted on 2011-03-25
9
Medium Priority
?
513 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 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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.
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

688 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