Its good to be back after two & a half months break. Probably when you become too active it’s a way to tell yourself to hold back and relax for a while. Well I spent my 2 months on bed rest not in a particularly good way.
But nothing hold you back from learning new things and this time it’s the Windows Media Services. I am using windows media services 9 on windows server 2003(yeah I know it was last used by Pharaohs )
The Problem :
I am working on a live webcasting project where I need to configure 6 media servers across the country to push the live video feed from one server to other. The drawback is that if the 1st media server is down or encoder is down it starts a chain reaction and turn off all the media servers. The problem is compounded with the cumbersome process of restarting the multicast publishing points. We need to run the Multicast announcement wizard all over again for each publishing point and for each server.
The solution
I came up with a couple of VB scripts.
First script is the one responsible for starting all the publishing points on the server.
1: set obj = createobject("WMSServer.server")
2: for each pubpt in obj.PublishingPoints
3: ' check for broadcast type
4: if pubpt.Type = 2 then
5: pubpt.Start
6: end if
7: next
8:
Save the above script as start.vbs on C Drive of WMS server. Running the script will start all the publishing points.
Now I need some mechanism to run this script (located on WMS server) from my local machine.
Below is the script which I save on the local machine as *.vbs and running this script will run the above script on each server.
1: 'Turning on WMS1
2: strComputer = "<IP of the WMS1>"
3: strCommand = "cscript c:\start.vbs"
4:
5: Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
6: Set objProcess = objWMIService.Get("Win32_Process")
7:
8: errReturn = objProcess.Create(strCommand, null, null, intProcessID)
9:
10: If errReturn = 0 Then
11: Wscript.Echo "All Publishing Point started at WMS1 with a process ID: " & intProcessID
12: Else
13: Wscript.Echo "Publishing Points at WMS1 could not be started due to error: " & errReturn
14: End If
15:
16: 'Turning on WMS2
17: strComputer = "<IP of the WMS1>"
18: strCommand = "cscript c:\start.vbs"
19:
20: Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
21: Set objProcess = objWMIService.Get("Win32_Process")
22:
23: errReturn = objProcess.Create(strCommand, null, null, intProcessID)
24:
25: If errReturn = 0 Then
26: Wscript.Echo "All Publishing Point started at WMS2 with a process ID: " & intProcessID
27: Else
28: Wscript.Echo "Publishing Points at WMS2 could not be started due to error: " & errReturn
29: End If
Points to remember with this process-
1. Sequence of the servers on the second script should be considered based on the webcasting feed layout. It means WMS1 to be started before WMS2 so that WMS should have source of WMS1 publishing points.
2. User who is executing 2nd script should have admin rights on all the WMS servers.
-Cheers