April 19, 2011

VLC distribution via Group Policy

By Geekphreek

VideoLANs VLC is one of the most powerful and in my mind, one of the best media players out there.  It’s opensource but they drive a lot of development of the H.264 codec which is prolific in just about every way.

One of the big annoyances how ever is, how the Hell do you roll this puppy out to Enterprise class networks… skipping the bull, how to roll to Microsoft Active Directory PCs??  Well there’s no MSI running around and I couldn’t be bothered to create one so I opted with a little script logic, whacked it in to GP under PC Start Up script and Bob, he is your Uncle.

Download the latest VLC from www.videolan.org, grab the ZIP pack and extract it.  Dump the VLC directory on to your server share in another directory called VLC (\\server\apps\VLC\VLC).  Make a copy of VLC.exe in to C:\program files\VLC\ and then create a shortcut from there in to c:\programdata\Microsoft\Windows\Start Menu\Programs\Media\ (this is a hidden folder).  Cut and paste your link you’ve created in to \\server\apps\VLC\.  Now time for the script, copy and paste in to a text file via notepad:

@echo off

if exist  “%programfiles%\vlc\vlc.exe” goto end
:: Copy VLC to Program Folder
xcopy \\server\apps\vlc\vlc “%programfiles%\vlc” /f /h /r /y /e /i

:: Copy shortcut to Start Menu\Media
copy \\server\apps\vlc\*.lnk “%programdata%\Microsoft\Windows\Start Menu\Programs\Media\” /y

:end

Now I don’t need my script to be very intelligent.  This literally checks to see if the VLC folder exists in Program Files and if it does, quits; else it copies over what it needs to install.  Save this in to \\server\apps\vlc and call it VLCInstall.cmd.

Fire up your GP Editor, new policy, VLC_Install, Settings Tab, Right click, edit, Computer Config, Policies, Windows Settings, Scripts, Startup.  Browser to your script, mine is at \\server\apps\VLC\vlcinstall.cmd and click ok, and close back out.  Link your policy to your group with a test PC and give it a whirl.

Script logic wise, if you’re being clever, use version numbers for the VLC, a la \\server\apps\VLC\VLC119 and you can then test for versions and install newer ones that way, or drop a text file in to “%programfiles%\vlc” called 119.txt, 120.txt, etc and check if it needs to be copied in again that way.