Web Development with Visual FoxPro
Stop a single website from VFP program
I need to be able to stop a SINGLE website from a scheduled VFP exe for maintenance, pack a table, and start the website
From VFP I can use:
RUN /n4 IISRESET /Stop
...Pack my tables...
RUN /n4 IISRESET /Stop
...to stop ALL websites, but I'd rather do them one at a time.
I have tried similar to this to no avail:
lcCmd = [%windir%\system32\inetsrv\appcmd stop site /site.name:"Default Web Site"]
RUN /N4 &lcCmd
TIA
The problem is the Environment variable in your command string:
%windir%\system32\inetsrv\appcmd stop apppool "MyAppPool"
You need to expand the environment variable before you RUN - RUN won't expand that. Also you have to run as Administrator.
Try this:
DO wwutils
IF !IsAdmin()
WAIT WINDOW "Command requires admin rights." TIMEOUT 5
RETURN
ENDIF
lcCmd = GetEnv("WinDir") + [\system32\inetsrv\appcmd stop APPPOOL "DefaultAppPool"]
RUN /n4 &lcCmd
+++ Rick ---