Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Powershell module? (Feature Request)#1697

ilgrank started this conversation inIdeas
Mar 23, 2023· 3 comments· 7 replies
Discussion options

Hi
as discussed here , the current release is,de facto , not fully usable in powershell due to powershell being unable to handle async events.

Since@chkr1011 mentioned the possibility of making a dedicated powershell module, Is there any chance (please! 🙏 ) that this will go on roadmap?

Thanks :)

You must be logged in to vote

Replies: 3 comments 7 replies

Comment options

I did not started yet due to lack of time but this is still a topic for the future.

You must be logged in to vote
2 replies
@ilgrank
Comment options

High hopes for that, keeping fingers crossed then, thanks! :)

@vireshov
Comment options

+1 !@chkr1011 :)

Comment options

Hi@chkr1011,

Thanks for considering this feature and thanks@ilgrank for making the request.

Definitely a +1 for this.

We are looking to use the MQTTnet library as a client to interact both ways with VMware VCD's MQTT broker for our own custom automation usecases. In the VMware "universe", PowerShell is the most common used automation language for automation purposes. Infra Engineers can automate, but they are not full fledged developers. Hence PowerShell has a strong use case.

As we need this functionality today, we are now going to attempt to create a simple lightweight wrapper around the MQTTnet Library, for the purposes we need it for...but a PS Module developed by you guys would be awesome.
We use PS7 on Linux, but I think this library has dotnet core support, right?

Is there any WIP and/or ETA for this feature?

Thank you for your attention to this matter !

You must be logged in to vote
0 replies
Comment options

Since we got AI these days I gave it a try even if I am absolutely no PowerShell expert but I created a branch and PR (#2215) which contains a very basic PowerShell module. Please let me know what you think. My next steps are exposing more Parameters and exposing several event handlers. There is also a Test.ps1 file which shows how to use the module.

You must be logged in to vote
5 replies
@ilgrank
Comment options

Hi!
Thanks for your effort!
I have tried checking out the powershell branch, but could not find any compiled DLL to try it. Could you please build one?
Many thanks

@chkr1011
Comment options

If you checked it out you only need to recompile the solution. Then you can execute the Test.ps1 powershell file. If you do not have any IDE and cannot compile the code I will try to embed it in the repo (for testing purposes only).

@ilgrank
Comment options

Thanks
I'm more of a scripting guy, and if you can provide a test DLL that would help greatly

@chkr1011
Comment options

I pushed the DLL. Let me know if it works.

@ilgrank
Comment options

I pushed the DLL. Let me know if it works.

Hi! Thanks for compiling the DLL!
I've tried it an so far, both connecting and posting do work perfectly!

The only problem I'm having is... you guessed it probably, with the message received event
It's not erroring, but neither I'm receiving any event (probably my fault):

Import-Module ./bin/Debug/net8.0/MQTTnet.PowerShell.dll -verbose$session = New-MqttSessionConnect-MqttSession -Session $session -Host "192.168.0.102" -username "user01" -password "password01"Publish-MqttMessage -Session $session  -Topic "Test" -Payload "Hello from PowerShell"Subscribe-MqttTopic -Session $session -Topic "OpenMQTTGateway/BTtoMQTT/*"#Receive-MqttMessage -Session $session -TimeoutSeconds 20#Disconnect-MqttSession -Session $session#Remove-MqttSession -Session $sessionRegister-ObjectEvent -InputObject $session -EventName MessageReceived -Action {        $topic = $EventArgs.Topic        $payload = $EventArgs.Payload        $qos = $EventArgs.QoS        $retain = $EventArgs.Retain        $userProps = $EventArgs.UserProperties                Write-Host "Received message: Topic=$topic, Payload=$payload, QoS=$qos, Retain=$retain"        if ($userProps.Count -gt 0) {            Write-Host "User Properties:"            foreach ($prop in $userProps.GetEnumerator()) {                Write-Host "  $($prop.Key): $($prop.Value)"            }        }    }

and I'm stuck here since a couple of days, and running out of ideas..

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
3 participants
@ilgrank@chkr1011@vireshov

[8]ページ先頭

©2009-2025 Movatter.jp