Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

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

Reply
 
Old 09-07-2007   #1 (permalink)
google


 
 

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-08-2007   #2 (permalink)
google


 
 

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


 
 

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
Reply

Thread Tools


Similar Threads
Thread Forum
Error: "Cannot convert "System.Object[]" to "System.Int32"." PowerShell
Vista x64 Driver "not signed" question... General Discussion
Service startup fails with "Access Denied" after Win2K3 domain joi Vista networking & sharing
Separate hashtable vs $alist | where-object { "key" = "value" } versus something else? PowerShell
False IE doc body error - "Object reference not set to an instance of an object" PowerShell


Vista Forums 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 Ltd

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