baramundisoftware / PS-bConnect

Powershell module for baramundi Connect (bConnect), the REST-API of the baramundi Management Suite
https://www.baramundi.com/en/management-suite/interfaces/
MIT License
26 stars 14 forks source link

bConnect does not work in PS 6.x and higher #53

Open domushnik opened 2 years ago

domushnik commented 2 years ago

Prior to placing the issue, please check following: (fill out each checkbox with an X once done)

Describe the bug When I import the bConnect module in PS 7.x I get the following error:

(4,40): error CS0246: The type or namespace name 'ICertificatePolicy' could not be found (are you missing a using directive or an assembly reference?)
public class ignoreCertificatePolicy : ICertificatePolicy {

According to the MS article ServicePointManager.CertificatePolicy Property, the property CertificatePolicy in the class ServicePointManager is obsoleted.

To Reproduce Steps to reproduce the behavior:

  1. Run Import-Module bConnect in PS 6.x or higer

Expected behavior The module should not contain any obsoleted properties.

System information Question Answer
My operating system Win10
baramundi Server Version 2020R1
PS-bConnect Version 20.1.0.5
T0biii commented 2 years ago

in the .psd file PowerShell Version 3.0 is specified https://github.com/baramundisoftware/PS-bConnect/blob/9730f097bd55cdedf3f0160bbdd3226c3111c29f/bConnect/bConnect.psd1#L9 maybe the obsoleted properties are not the only blocker für PowerShell 6.x?

T0biii commented 2 years ago

@domushnik I tested the Get-bConnectInfo command: image but i got an the same error at the import

domushnik commented 2 years ago

@T0biii , yes. Also, it makes impossible to ignore the server certificate.

T0biii commented 2 years ago

@T0biii , yes. Also, it makes impossible to ignore the server certificate.

if you have any idea how to fix it for PS 6.x and still got support for PowerShell 3.x? PRs are welcome

DanielK37 commented 5 months ago

Although this thread is somewhat old, I would add my experience from just a few minutes ago: I run PS version 7.4.2 on Windows 10 and at first when trying to import this module I also received this message (that is actually why I landed on this page):

(4,40): error CS0246: The type or namespace name 'ICertificatePolicy' could not be found (are you missing a using directive or an assembly reference?) public class ignoreCertificatePolicy : ICertificatePolicy {

But when I did run the import a second time several minutes later it ran successful and I was able to initialize a connection to our baramundi server.