471,593 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,593 software developers and data experts.

Script to start Windows Media Player as a service

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!
Aug 22 '07 #1
0 2534

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Mickel Grönroos | last post: by
4 posts views Thread by BobAchgill | last post: by
3 posts views Thread by UJ | last post: by
reply views Thread by Bev | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.