Hey Everyone, this is my first time posting so go easy on me. I am trying to hook up music-on-hold at the office I work at. I got all the music loaded and I got Windows Media Player working while the phones are on hold, but now I am trying to write a script that will allow Windows Media Player to run as a service so I can make it auto-start with out needing a user logged in on the computer. Also it would allow the music-on-hold to work if we had a power outage and the system re-started. This is what I got so far...
Const OWN_PROCESS = 16
Const NOT_INTERACTIVE = True
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objService = objWMIService.Get("Win32_BaseService")
errReturn = objService.Create ("MediaPlayer", "Windows Media Player", _
"C:\Program Files\Windows Media Player\wmplayer.exe", OWN_PROCESS ,2 ,"Automatic" , _
NOT_INTERACTIVE ,".\LocalSystem" ,"")
The script makes a WMP Service in the Services area that can be manipulated and Windows Media Player starts to open but then it turns back off. Since the program doesn't stay open it doesn't work after a re-start. Any help would be great, I'm a total novice and this is the first script I have ever wrote.
Thanks!