Skip to content

failed due to the following error Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). #1

@alexlaverty

Description

@alexlaverty

Hi I cloned your repo and tried to run the script, it failed with the following error :

PS C:\src\Bulk_PDF_Encryption_Utility> C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1

GAC    Version        Location                                                                                                                                                                                                      
---    -------        --------                                                                                                                                                                                                      
False  v2.0.50727     C:\src\Bulk_PDF_Encryption_Utility\dll_library\itextsharp.dll                                                                                                                                                 
new-object : Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 
(REGDB_E_CLASSNOTREG)).
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:40 char:8
+ $excel=new-object -com excel.application
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMException
    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
 
The property 'DisplayAlerts' cannot be found on this object. Verify that the property exists and can be set.
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:41 char:1
+ $excel.DisplayAlerts = $false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
The property 'Visible' cannot be found on this object. Verify that the property exists and can be set.
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:42 char:1
+ $excel.Visible = $false
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
 
You cannot call a method on a null-valued expression.
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:43 char:1
+ $workbook=$excel.workbooks.open($excelReferenceSheet)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:44 char:1
+ $worksheet=$workbook.Sheets.Item($excelSheetNumber)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
RowCount: 0
ColumnCount 0
You cannot call a method on a null-valued expression.
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:95 char:1
+ $excel.Quit()
+ ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:99 char:1
+ [System.Runtime.Interopservices.Marshal]::ReleaseComObject($worksheet ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException
 
Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:100 char:1
+ [System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException
 
Remove-Variable : Cannot find a variable with the name 'excel'.
At C:\src\Bulk_PDF_Encryption_Utility\pdfEncrypt_v1.0.ps1:102 char:1
+ Remove-Variable -Name excel
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (excel:String) [Remove-Variable], ItemNotFoundException
    + FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.RemoveVariableCommand

My system info is :

systeminfo

OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19044 N/A Build 19044
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 42 Stepping 7 GenuineIntel ~1600 Mhz
BIOS Version:              American Megatrends Inc. 3603, 11/9/2012
Windows Directory:         C:\WINDOWS
System Directory:          C:\WINDOWS\system32
Hotfix(s):                 12 Hotfix(s) Installed.
                           [01]: KB5017022
                           [02]: KB4562830
                           [03]: KB4570334
                           [04]: KB4577586
                           [05]: KB4580325
                           [06]: KB4586864
                           [07]: KB5003791
                           [08]: KB5012170
                           [09]: KB5017308
                           [10]: KB5014032
                           [11]: KB5015895
                           [12]: KB5016705

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions