LFA Posted June 22, 2005 Share Posted June 22, 2005 Just some examples so you can get started. This script gets a list of services installed on the current server and displays them in the console. It can easily be modified to restart each service. Visual Basic and C# included. To have the console close automatically just change <waitForUserAction value="true"/> to <waitForUserAction value="false"/> Visual Basic .NET <tcascript> <language name="VB" /> <waitForUserAction value="true"/> <scriptCode><![CDATA[ Imports System Public Class Test Public Shared Sub Main() Console.WriteLine("Getting a list of services on this server...") 'Get this server's id dim thisServerId as String = TCAdminSDK.Info.GetThisServerId() 'Get a list of all services on this server Dim services() As TCAdminSDK.Objects.Service = TCAdminSDK.Objects.Service.GetServicesByServerId(t hisServerId) for each s as TCAdminSDK.Objects.Service in services 'Write the service id Console.WriteLine(s.ServiceID) next Console.WriteLine("Done. Press any key to continue.") End Sub End Class ]]></scriptCode> </tcascript> C# <tcascript> <language name="C#" /> <waitForUserAction value="true"/> <scriptCode><![CDATA[ using System; public class Test{ public static void Main(){ Console.WriteLine("Getting a list of services on this server..."); //Get this server's id string thisServerId = TCAdminSDK.Info.GetThisServerId(); //Get a list of all services on this server TCAdminSDK.Objects.Service[] services; services = TCAdminSDK.Objects.Service.GetServicesByServerId(t hisServerId, null); foreach(TCAdminSDK.Objects.Service s in services){ //Write the service id Console.WriteLine(s.ServiceID); } Console.WriteLine("Done. Press any key to continue."); } } ]]></scriptCode> </tcascript> Link to comment Share on other sites More sharing options...
Recommended Posts