Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.25k stars 568 forks source link

Mesh agent error on Windows Server 2022 #5337

Closed energywave closed 8 months ago

energywave commented 1 year ago

Describe the bug I could not launch the mesh agent on a customer's Windows Server 2022 x64.

To Reproduce Steps to reproduce the behavior: Try to launch a Service & Interactive Mesh Agent on a x64 Windows Server 2022. It could fail on the console window immediately. But I have also cases of same OS/bits that works correctly.

Expected behavior Should launch and show the initial GUI to install.

Screenshots Sorry, no much to show

Server Software (please complete the following information):

Client Device (please complete the following information):

Remote Device (please complete the following information):

Additional context On the console there is the following output: [2023-09-08 03:50:28 PM] [AD262CB981431433] ..\microscript\ILibDuktape_ScriptContainer.c:1667 (0,0) uncaught: 'cannot read property \x27split\x27 of null'

Your config.json file


{
    "settings": {
        "Cert": "XXXXXX",
        "Port": 555,
        "RedirPort": 81,
        "_minify": true
    },
    "smtp": {
        "host": "192.168.2.3",
        "port": 25,
        "from": "XXXXX@YYYYYYYYY",
        "tls": false,
        "tlscertcheck": false,
        "tlsstrict": false
    },
    "domains": {
        "": {
            "assistantCustomization": {
                "title": "XXXXXXXXXX - Helpdesk",
                "image": "XXXXX.png",
                "filename": "XXXXXXX-helpdesk"
            }
        }
    }
}```
si458 commented 1 year ago

Try to launch a Service & Interactive Mesh Agent on a x64 Windows Server 2022. It could fail on the console window immediately. can you explain more? you just download the exe from meshcentral and double click to run? you dont use ANY console/terminal windows? i have meshagent running on 4 x server 2022 vms with no issues?

PathfinderNetworks commented 1 year ago

Almost certainly this is caused by whatever antivirus/antimalware app is installed on the server. I'm assuming your MeshAgent is not signed by your own verified code signing certificate?

energywave commented 1 year ago

you just download the exe from meshcentral and double click to run? you dont use ANY console/terminal windows?

I generated an invite link for service and interactive, I opened that link from the client's browser (Chrome), downloaded the x64 mesh agent (but I also tried to transfer the agent on my own, same result) and by running it by double click I just see a console window that appears and immediately disappears. By launching from the console I can see the error message that I reported in the issue.

i have meshagent running on 4 x server 2022 vms with no issues?

I also have some Windows 2022 machine between my clients and they works great. But on that machine that error prevents to run the agent, what a pity.

Almost certainly this is caused by whatever antivirus/antimalware app is installed on the server. I'm assuming your MeshAgent is not signed by your own verified code signing certificate?

I also believed that at first as in my experience antiviruses are the issue n.1 about running agents. But that server hadn't an antivirus installed (well, I'm not sure 100%, I just had time to see system tray and there wasn't an antivirus icon but I could not check in more details). Furthermore when the antivirus is the issue the behavior is different: you launch the agent exe and you get an error that states you cannot run it or the exe disappears from the filesystem (as it is quarantined). This is not such a case. About the certificate you're right, it's not signed.

si458 commented 1 year ago

Hmm that's seems strange?

Daft stupid question, is the server all up to date with updates?

What's the latest monthly update it did?

What's the version the server 2022 is on?

I'll try replicate it here if I can

Also if u right click the exe and do properties, do u see the tab saying 'digital certificate', what's the certificate it shows?

energywave commented 1 year ago

Today I had the opportunity to connect again to that server for some time. This is the screenshot for system information (OS version and build): Orobica server info

And here is the pending updates: Orobica server aggiornamenti

I don't know much more as I'm not managing that server that was installed at July by the IT company that manages it for the customer.

But maybe checking the mesh agent source at the line specified in the error could lead to some hints about why it's stuck there. [2023-09-08 03:50:28 PM] [AD262CB981431433] ..\microscript\ILibDuktape_ScriptContainer.c:1667 (0,0) uncaught: 'cannot read property \x27split\x27 of null'

silversword411 commented 1 year ago

Sounds like AV to me

si458 commented 1 year ago

@energywave running identical version (just one update difference) and works with no issues Screenshot_20230913_231757.jpg Screenshot_20230913_232303_Firefox

Email me when u have a min, and I will email over our exe from our meshserver, and see if u can run/install etc (Don't worry the groups setup to autodelete the computers, haha)

energywave commented 1 year ago

@energywave running identical version (just one update difference) and works with no issues !

Yes, I know. I also have a Windows 2022 server connected without issues to Mesh Central. It's an issue I've seen only on that machine (that is freshly installed by an IT company for my customer)

Email me when u have a min, and I will email over our exe from our meshserver, and see if u can run/install etc

You're very kind, thank you. But I assume that I'll not able to do that as I've completed my operation on the customer's server using AnyDesk and I think I'll not able to connect there for much time. In reality I've opened the issue not so much to resolve my need but to let you know about an error that could arise maybe on other machines so that you can correct it, if you want, to grow the beautiful project. In case I'll have an opportunity to connect I'll let you know, however.

tomsik-radek commented 1 year ago

I get an identical error message when trying to run Agent in Windows Sandbox

PS C:\Users\WDAGUtilityAccount\Downloads> .\meshagent64-Temp.exe

[2023-09-16 03:34:20 PM] [AD262CB981431433] ..\microscript\ILibDuktape_ScriptContainer.c:1667 (0,0) uncaught: 'cannot read property \x27split\x27 of null'

Might be related to HyperV in some way?

Works fine on my Server 2022 VM (which is on Proxmox)

si458 commented 1 year ago

@tomsik-radek how do u setup the 'windows sandbox' what OS did you use? i just cant replicate it here at all...

tomsik-radek commented 1 year ago

@tomsik-radek how do u setup the 'windows sandbox' what OS did you use? i just cant replicate it here at all...

https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-overview

Turn on Windows Features On or Off -> Windows Sandbox

Host machine runs Windows 11 Pro

si458 commented 1 year ago

thanks for the hint @tomsik-radek, i see the same thing with Windows 11 Pro Sandbox BUT not with Windows 11 Pro? so im guessing its some sort of security it doesnt like? maybe?

@energywave i was able to get it to install by doing the following:

  1. run terminal/powershell as admin
  2. cd to folder where u downloaded exe
  3. running .\meshagent64-TestGroup.exe -fullinstall

even got control of the sandbox environment haha

tomsik-radek commented 1 year ago

So GUI install method crashes but CLI install method works fine?

si458 commented 1 year ago

So GUI install method crashes but CLI install method works fine?

@tomsik-radek yes it seems that way in the sandbox, so it might be @energywave customers sever is running some sort of sandbox security maybe?

tomsik-radek commented 1 year ago

I tried it on a Windows 2019 VM that is running on 2019 HyperV. No issues there. I don't have a 2022 hypervisor to test on, sorry.

Given the Sandbox account is WDAGUtility, ie Windows Defender, it might be related to that. Our work servers don't use Defender. But my personal 2022 VM at home does and no issues there (but that is on Proxmox)

si458 commented 1 year ago

we also dont know if this is a VM or a physical server running Server 2022 and if its a VM, whats the underlying hypervisor? esxi, hyperv, virtualbox, proxmox?

tomsik-radek commented 1 year ago

we also dont know if this is a VM or a physical server running Server 2022 and if its a VM, whats the underlying hypervisor? esxi, hyperv, virtualbox, proxmox?

OP's problem? He says it in his first post, Win2022 VM on Win2022 HyperV.

As for Sandbox, that uses HyperV on your local machine.

si458 commented 8 months ago

Fix is here for others

https://github.com/Ylianst/MeshCentral/issues/3791#issuecomment-1925955779

https://github.com/Ylianst/MeshAgent/issues/121#issuecomment-1025051594

You need to repair the windows wmi registry!