Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Windows Media Server / November 2003

Tip: Looking for answers? Try searching our database.

Remote start of publishin points

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter - 24 Nov 2003 22:22 GMT
Hello

i'm looking for a sollution to start publishing points
remotely.

I have found a script that remotely start the media
server , but i still have to start the publishingpoints
by hand. Is there anyboddy that can help me , i'm new at
this. The Jscript i use is below.

Thanks
Peter

/*--------------------------------------------------------
-------------
Copyright (C) Microsoft Corporation. All rights reserved.
Script name    : Start the Windows Media Server Service
(startservice)  
Script version : 1.0
Description    : This script starts the Windows Media
Service on the
specified Server. If the -s parameter is not specified,
the service on the
local machine should be started.  
          [-s <Server1, [Server2, Server N]>]
where  -s represents target server.
Example : startservice -s server1,server2
Returns  :
1. Usage: startservice [-s <Server1, [Server2, Server N]
>]
2. Server %server% is not a valid WMS Server
OS Requirements       :  Windows Server 2003 (all
versions)
Software requirements :  WMS Server
Scripting Engine      : Jscript
----------------------------------------------------------
-----------*/
var szEachArgument = "";
var objWMI = null;
var objWMIServices = null;
var dwEachArg = 0;
var szTemp = "";
var objArgs = WScript.Arguments;
var dwNumArgs = WScript.Arguments.length;

// Parse the command to separate out the server names  

while(dwEachArg< dwNumArgs )
{
   szEachArgument = objArgs( dwEachArg );
   if( szEachArgument.toLowerCase()== "-s" )
   {  
       dwEachArg = dwEachArg + 1;
       if( dwEachArg >= dwNumArgs )    //ex:
startservice -s
       {
           DisplayUsage();
       }
       szEachArgument = objArgs(dwEachArg);  
       objArgs=szEachArgument.split(",");        
   }          
   else
   {
       DisplayUsage();     //ex: startservice -s s1,s2
junk
   }  
   dwEachArg = dwEachArg + 1;
}  

if(objArgs.length == 0)
{
   //i.e. if server name is not mentioned, then start
Publishing points on localhost  
   try
   {
       objWMI = ActiveXObject("winmgmts:");
       objWMIServices = objWMI.Get
("Win32_Service.Name='wmserver'")
       objWMIServices.startService;
       szTemp = "Server 'LocalHost' started successfully
\n";
   }
   catch(e)
   {
       var errorcode = e.number >>> 0;
       szTemp = "Error Code 0x" + errorcode.toString(
16 ) + ": 'LocalHost' could not be started \n";
   }
}
else
{
   szTemp = "";
   var dwEachServer = 0;
   var szEachServerName = "";
   while( dwEachServer < objArgs.length )  
   {
       szEachServerName = objArgs[ dwEachServer ];
       try
       {
           var strPath = "winmgmts://" +
szEachServerName;
           objWMI = ActiveXObject(strPath);
           objWMIServices = objWMI.Get
("Win32_Service.Name='wmserver'")
           objWMIServices.startService;
           szTemp = szTemp + "Server '" +
szEachServerName + "' started successfully \n";    
       }
       catch(e)
       {
           var errorcode = e.number >>> 0;
           szTemp = szTemp + "Error Code 0x" +
errorcode.toString( 16 ) + ": '" + szEachServerName + "'
could not be started \n";
       }
       dwEachServer = dwEachServer + 1 ;
   }
}  

Trace( szTemp );

function DisplayUsage()
{
   szTemp = "Usage: StartService [-s <Server1, [Server2,
ServerN]>] \n";  
   szTemp = szTemp + "If server name(s) is/are not
mentioned, local host is the default server \n";
   Trace( szTemp );
   WScript.Quit(1);
}

function Trace(Msg)
{
   WScript.Echo(Msg);
}
Ravi Raman - 24 Nov 2003 23:52 GMT
Hi Peter,

You can manipulate the server using scripts as the server
exposes a scriptable object model. I have given the sample
code below and I think the WMServices SDK has some sample
JScripts too.

You will need to replace "yourremoteserver" with the name
of your remote server and "Sample_Broadcast" with the name
of the broadcast publishing point that you want to start
in the script snippet below.  Note that you need to have
permission to manipulate the remote server or else the
first line will fail with access denied.

  objServer = new ActiveXObject
( "WMSServer.server", "yourremoteserver" );
  objPubPoint = objServer.PublishingPoints.Item
("Sample_Broadcast");
  objPubPoint.Start();

Thx,
Ravi
--
This posting is provided "AS IS" with no warranties, and
confers no rights.

>-----Original Message-----
>Hello
[quoted text clipped - 134 lines]
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.