473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Restarting IIS with a batch file if x exists

I am trying to write a batch file to do this basically and i know i dont have it right so if anyone could help me i would appreciate it.. Basically the reason i need to do this is we have an outsourced project and the company will not give the outsourced company sufficient access on the server to restart iis through VPN

I tried just a simple batch file and had them run it but that then ran it on their machine and not on our server.. so i would like to schedule this process to run every x seconds so all they have to do is create a txt file for iis to restart.. however i don't know how to write this batch file.. here is what i have if anyone can help..

Expand|Select|Wrap|Line Numbers
  1. @echo off
  2. REM - File: iisrestarter.bat
  3. REM - Description: checks for the existence of iisrestart.txt then restarts iis and deletes the txt file
  4. IF EXIST restartiis.txt
  5. echo Restarting IIS and FTP.....
  6. echo ===================================================
  7. net stop "World Wide Web Publishing Service"
  8. net start "World Wide Web Publishing Service"
  9. net stop "FTP Publishing Service"
  10. net start "FTP Publishing Service"
  11. echo Y | DEL restartiis.txt
  12. echo ===================================================
  13. echo IIS and FTP Restarted
Nov 27 '07 #1
1 6402
Ok I think i figured it out.. unless someone knows a better way

Expand|Select|Wrap|Line Numbers
  1. @echo off
  2. REM - File: iisrestarter.bat
  3. REM - Description: checks for the existence of iisrestart.txt then restarts iis and deletes the txt file
  4.  
  5. IF EXIST restartiis.txt (GOTO :true) ELSE GOTO :false
  6.  
  7. :true
  8. echo Restarting IIS and FTP.....
  9. echo ===================================================
  10. net stop "World Wide Web Publishing Service"
  11. net start "World Wide Web Publishing Service"
  12. net stop "FTP Publishing Service"
  13. net start "FTP Publishing Service"
  14. echo Y | DEL restartiis.txt
  15. echo ===================================================
  16. echo IIS and FTP Restarted
  17.  
  18. :false
  19. echo restartiis.txt is missing
  20.  
Nov 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: konsu | last post by:
hello, i would like to write a batch file with all sql commands necessary to create a database, its tables, and populate them with initial data. would the experts please help me with these...
6
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
1
by: Charles | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
1
by: steve | last post by:
Hi all, Here's some work in progress that should allow you to run a batch file as a custom action in a VS deployment project. Yup I know you can use js or wsh, but the target may not have...
0
by: neo3114 | last post by:
Hi, Can anyone tell me how using reg.exe i can check if i a registry key exists in a batch file and fail if it does. i assume its a for statement and followed by if but just cant get the...
14
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in...
0
by: myself337 | last post by:
in VB you can do this: Imports System Imports System.IO Module Module1 Sub Main() Dim path As String = "c:\temp\filetocopy.txt" ' put the file you
1
by: deepikabg | last post by:
Hi, Im v.new to postgres. I needed some help writing batch files. I wanted to run psql commands in a batch file. I give 2 inputs to the batch file -- Username and Database name I want my batch...
0
by: brendan | last post by:
I'm trying to write a code that batch renames photos. In the end each photo should be named: AABBB1111YYYYMM222 where AABBB1111 defines a given place. (i.e. CAMTL = montreal and four digits...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.