Hi,
I’m trying to find the right syntax for checking for the existence of a service. I have the user enter the Service name on the Description tab before starting the action, using:
<Description><![CDATA[<TABLE>
<TBODY>
<TR>
<TD>
<P><LABEL for=acct><script>document.body.ontakeaction = function() {
var acct = document.getElementById("acct").value;
if ( acct == null || acct == "" ) {
alert("Domain account is required");
return false;
}
var pass = document.getElementById("pass").value;
if ( pass == null || pass == "" ) {
alert("Password is required");
return false;
}
var svc = document.getElementById("svc").value;
if ( svc == null || svc == "" ) {
alert("Service Account is required");
return false;
}
TakeSecureFixletAction( Relevance('id of current fixlet'), Relevance('id of current bes site'), "Action1", {}, {acct: acct, pass: pass, svc: svc} );
return false;
}
</script>Domain Account:</LABEL> </P></TD>
<TD><INPUT id=acct size=19 value=DOMAIN\MYSVC name=acct> </TD></TR>
<TR>
<TD><LABEL for=pass>Password:</LABEL> </TD>
<TD><INPUT id=pass type=password name=pass> </TD></TR>
<TR>
<TD><LABEL for=svc>Service Account:</LABEL> </TD>
<TD><INPUT id=svc size=60 name=svc> </TD></TR>
</TBODY></TABLE>
<P> </P>
<P>Domain Account will be in the format:<BR>Domain\Account (ie., DOMAIN\MyService)</P>]]></Description>
And then using this to test to see if the service exists (I tried to use exits to find how things were going:
if { exists service “{parameter “svc”}” }
//wait sc config “{parameter “svc”}” obj= “{parameter “acct”}” password= “{parameter “pass”}”
//wait net start {parameter “svc”}
exit (2)
else
exit (4)
endif
I commented out the wait lines until I am sure the code is working as expected.
Thanks,
Bob_K