thijs
(Fresh Scripter)
2004-05-09 02:46 PM
Starting IIS service

How can i start the IIS service. And write that result to an TXT file.
Below is the script i have made but it gifs an error on line 9.

Can someone help me.
Break on
$f=2
$date=@DATE
$chr10=Chr(10)
Do
? "@TIME / @DATE"

$www=Run "cmd /c net start W3SVC"
Sleep 15
$iis=Run "cmd /c net start IISADMIN"
Sleep 15
$ftp=Run "cmd /c net start MSFTPSVC"
Sleep 15
$rep=Run "cmd /c net start RpcSs"

Open (1,"D:\scripts\logiis\$date.txt",5)
WriteLine (1,"---------------------------- $chr10 Log van: @TIME/@DATE $chr10 $chr10 De IIS admin service is: $iis $chr10 $chr10 De webservice is:$www $chr10 $chr10 De ftpservice is:$ftp De Replication services is: $rep $chr10 ----------------------------"
Close (1)
Sleep 300
Until $f=1


Les
(KiX Master)
2004-05-09 03:02 PM
Re: Starting IIS service

Your RUN lines are all wrong. See the FAQ
Not quite everything you wanted to know about RUN and SHELL


thijs
(Fresh Scripter)
2004-05-09 03:04 PM
Re: Starting IIS service

But with out the $ sign it works.....

I don't understand that. Do you have an explenation


Les
(KiX Master)
2004-05-09 03:08 PM
Re: Starting IIS service

I don't believe you. You cannot redirect output from RUN to a var with $www=Run! Did you even read the FAQ?

thijs
(Fresh Scripter)
2004-05-09 03:10 PM
Re: Starting IIS service

Off course i red the FAQ.
But is there an other options be side this one ">>"(Dos command)


Les
(KiX Master)
2004-05-09 03:13 PM
Re: Starting IIS service

THere are several PIPE() UDFs posted that let you skip the redirect to file.

thijs
(Fresh Scripter)
2004-05-09 03:16 PM
Re: Starting IIS service

Oke thanks i will have an look around

Les
(KiX Master)
2004-05-09 03:17 PM
Re: Starting IIS service

There are also several SERVICE() UDFs posted that will start and report the status.