Wednesday, January 12, 2011

Deploying VC-1 Video Codec for Windows Media Player 10 (wvc1dmo.cab)

How to deploy from command line a VC-1 Video Codec for Windows Media Player 10?

It is normally installed while visiting a page containing video encoded in VC-1, like this one (Eurovision 2009 video, not for the faint of heart, beware). But this requires administrative privileges and is interactive so impractical on many workstations.

IE downloads a file wvc1dmo.cab containing wvc1dmo.inf and wvc1dmod.dll and installs it somehow. But how to do this from command line, unattended?

  • Quick and dirty way - Extract the files and run:

    rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 wvc1dmo.inf
    

    I'd probably package the DLL into an MSI and deploy it that way.

    Edit:

    Rundll32 doesn't seem to want to run unless the path to the INF is specified as ".\wvc1dmo.inf". Even then, the INF installer (invoked from the command-line or from right-click / Install) doesn't actually register the DLL! Here's a deployment script that can be placed into a share on a server comptuer and invoked as a startup script. (I think, for my networks, I'd still deploy this thing in an MSI, but I don't have time to build an MSI this morning).

    @echo off
    SET SRC=\\test-pc01\foo
    SET DEST=%TEMP%\%RANDOM%.TMP
    
    rem Query for installation
    reg query "HKCR\Software\Microsoft\Multimedia\Components\Installed\codec_wvc1dmo\Uninstall"> NUL 2>NUL
    if errorlevel 1 goto do_install
    goto end
    
    :do_install
    rem Make temporary directory and copy down files
    mkdir "%DEST%"
    xcopy "%SRC%" "%DEST%" /y
    
    rem Change directory and drive to destination location (as setupapi has to be called with
    rem current directory .\ specified on command line. Dumb, dumb, dumb...)
    pushd %DEST%
    %DEST:~0,2%
    
    rem Call setupapi to perform installation
    start /wait rundll32.exe setupapi,InstallHinfSection DefaultInstall.Nt 132 .\wvc1dmo.inf
    
    rem Dumb thing doesn't seem to register itself
    regsvr32 /s %SystemRoot%\System32\wvc1dmod.dll
    
    popd
    
    rem Remove temporary files
    rmdir /s /q "%DEST%"
    
    :end
    

    That works, and my conscience is somewhat clearer. Next time, I'll test a little more before I go posting an "answer". My apologies.

    Tometzky : This did not work. I ended up with opening a sample file from http://samples.mplayerhq.hu/V-codecs/WVC1/ and manually accepting a codec on every workstation. I have only about 40 workstations so this was possible.
    Evan Anderson : I'm sorry about that. I pulled the command-line out of the registry for the right-click / Install behaviour and didn't actually test it. See my edit above. I've included a script (which you probably don't need now, but in the interests of keeping a clear conscience I have included anyway) that I've just tested on two WinXP VM's and seems to work fine.
    Tometzky : Just tested an improved version. Works like a charm. Thanks.
    Evan Anderson : Glad I could help out. I ended up needing to have a script to do this just a few weeks after I wrote it for Server Fault. Good thing, this.

0 comments:

Post a Comment