Question

I have installed the PowerShellPack on a Server 2008 R2 machine, but am unable to use the PSImageTools module. All image operations yield the error New-Object : Cannot load COM type Wia.ImageFile. I have tried installing the same package on my Windows 7 laptop, and there it works.

I figure this must be because of missing Dll:s on the server, but even copying the wia*.dll files to System32 from the laptop (there are no corresponding files already in place) helps. It is not possible to register the dlls (regsvr32 wiaaut.dll, for instance), that is replied to with "The file failed to load".

So, has anybody successfully used Wia on Windows Server 2008? We're going to run a scheduled powershell script to update the outlook image of our users, so it needs to be able to run on the server.

Was it helpful?

Solution

I get the same error on Windows Server 2008 x64. Tried both x64 and x86 version of PowerShell v2.

As an alternative you might be able to use System.Drawing.Image. Depends on what your script needs to do. Perhaps post some example code.

http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx

Add-Type -AssemblyName System.Drawing
$image = [System.Drawing.Image]::FromFile("C:\pic.bmp")

EDIT: Here's how you can change an image's dimensions:

$pixWidth = 90
$pixHeight = 90
$image2 = New-Object System.Drawing.Bitmap -ArgumentList $image, $pixWidth, $pixHeight
$image2.Save('C:\new_pic.bmp', [System.Drawing.Imaging.ImageFormat]::Bmp)

OTHER TIPS

Found this article after quite a bit of searching: http://kb.winzip.com/kb/entry/207/

Basically, you need to enable and set to Automatic the "Windows Image Acquisition" service in Windows 2003, or in Windows 2008, install the Desktop Experience feature first, then enable the "Windows Image Acquisition" service and set to Automatic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top