Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

new-object -comobject "CAPICOM.Signed" failing on Win2k3?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 09-07-2007   #1 (permalink)
google
Guest


 

new-object -comobject "CAPICOM.Signed" failing on Win2k3?

Hi all,

I have written a script which uses CAPICOM and a PFX cert to silently
sign executables. This works very well on my XP dev-box. However,
when I deployed it to our Windows Server 2003 build-box, it doesn't
work.

The new-object call succeeds (well, as near as I can tell). However,
when it gets to "$signedcode.FileName =", PowerShell complains that
there is no FileName member!

Piping the frieshly-created object into get-member yields the
following, different results on each system:

XP:
--------------------------------------------------------------------------------
TypeName: System.__ComObject#{84fbcb95-5600-404c-9187-ac25b4cd6e94}

Name MemberType Definition
---- ---------- ----------
Sign Method void Sign (ISigner2)
Timestamp Method void Timestamp (string)
Verify Method void Verify (bool)
Certificates Property ICertificates2 Certificates () {get}
Description Property string Description () {get} {set}
DescriptionURL Property string DescriptionURL () {get} {set}
FileName Property string FileName () {get} {set}
Signer Property ISigner2 Signer () {get}
TimeStamper Property ISigner2 TimeStamper () {get}
--------------------------------------------------------------------------------

Windows Server 2003:
--------------------------------------------------------------------------------
TypeName: System.__ComObject

Name MemberType Definition
---- ---------- ----------
CreateObjRef Method System.Runtime.Remoting.ObjRef
CreateOb...
Equals Method System.Boolean Equals(Object obj)
GetHashCode Method System.Int32 GetHashCode()
GetLifetimeService Method System.Object
GetLifetimeService()
GetType Method System.Type GetType()
InitializeLifetimeService Method System.Object
InitializeLifetimeService()
ToString Method System.String ToString()
--------------------------------------------------------------------------------

Under Win2k3, the typename is missing the GUID, and none of the
correct members are in the object! CAPICOM 2.1.0.2 is installed on
each system and the DLL is registered.

Can anyone shed any light on why I can't instantiate
CAPICOM.SignedCode on Win2k3?


My System SpecsSystem Spec
Old 09-07-2007   #2 (permalink)
google
Guest


 

Re: new-object -comobject "CAPICOM.Signed" failing on Win2k3?

After tearing my (non-existent) hair out about this, I finally found
the problem.

On the system there were *three* different CAPICOM DLLs:
1) C:\Program Files\Microsoft CAPICOM 2.1.0.2\Lib\X86\capicom.dll
(2.1.0.2)
2) C:\Windows\System32\capicom.dll (1.0.0.2)
3) C:\Program Files\Common Files\Microsoft Shared\CAPICOM\CapiCom.dll
(2.1.0.1)

#3 was registered when what I wanted was #1. The tipoff was the
default value of the key:
HKEY_CLASSES_ROOT\CLSID\{03ACC284-
B757-4B8F-9951-86E600D2CD06}\InprocServer32

which was erroneously pointing toward the Common Files\Microsoft
Shared version.

Once I *unregistered* the other DLLs and re-registered the correct
one, CAPICOM began working from PowerShell with no further problem.


My System SpecsSystem Spec
Old 09-08-2007   #3 (permalink)
Hal Rottenberg
Guest


 

Re: new-object -comobject "CAPICOM.Signed" failing on Win2k3?

google@xxxxxx wrote:
Quote:

> After tearing my (non-existent) hair out about this, I finally found
> the problem.
>
> On the system there were *three* different CAPICOM DLLs:
I share your pain. I ran into this the other month when there was a CAPICOM
patch released from Microsoft. In my job I have to test patch deployments and
produce vulnerable and non-vulnerable states of a given security vulnerability
and CAPICOM was being very elusive.

Glad you figured it out!


--

Hal Rottenberg
blog: http://halr9000.com
powershell category:
http://halr9000.com/article/category...ng/powershell/
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: "Cannot convert "System.Object[]" to "System.Int32"." Shay Levi PowerShell 3 01-31-2008 04:16 AM
Vista x64 Driver "not signed" question... teknomedic General Discussion 10 09-11-2007 01:09 PM
Service startup fails with "Access Denied" after Win2K3 domain joi =?Utf-8?B?c3JzaG93ZXJz?= Vista networking & sharing 11 09-06-2007 09:52 AM
Separate hashtable vs $alist | where-object { "key" = "value" } versus something else? ydroam PowerShell 2 12-12-2006 05:16 PM
False IE doc body error - "Object reference not set to an instance of an object" Alex K. Angelopoulos [MVP] PowerShell 7 07-15-2006 09:46 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51