-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows 11 24H2 26100 has WMIC disabled by default #254
Windows 11 24H2 26100 has WMIC disabled by default #254
Comments
This isn't a bug but something wrong with ur setup of windows Please see issues in main meshcentral about this issue Also here in meshagent repo too #121 |
Yeah, it's not a "bug" currently, it's fixable by installing WMIC (The linked post does not fix it, because the issue is that the wmic executable does not exist on the system), but Microsoft is already in the process of removing the WMIC executable, so this will eventually become a problem that is only solvable by modifying the agent source. Even now, the agent does not work on default windows installations from 24H2 26100, and requires an additional installation step which is not documented anywhere as far as I can tell. It's probably a good idea to update the code now, before it becomes totally broken on future windows versions. |
if you can share the steps how you installed the WMIC on those version of windows, |
Open an administrator powershell and run:
This will work as long as you have permissions to do so. Some organizations will block that capability, though. I don't think there's any way around it if your organization does that. |
basically need to change the WMIC commands to powershell, For example (I think cause no very little about JS
could replace MeshAgent/modules/util-language.js Line 982 in 81877a3
|
@dinger1986 if u check the code tho wmic is listed in quite a few places including meshcentral and meshagent |
14 functions or commands need replaced, most have drop in replacements ie restarting a service can be done with net stop/net start |
I would like to try to take a stab at tackling this, but I can't find any information about building the agent and the testing process, etc. Is there any documentation about building the agent on different environments and then testing the newly built code? Just open the sln in visual studio(?), build, and replace the executables in my meshcentral instance? Just guesses, I'm not so familiar with this part of the meshcentral process. |
That's basically the process! If it's all C code you need to change, open VS then edit n build, copy, restart let it autouodate machines or download and reinstall For windows agents However, if you have to change any of the modules in the modules folder, u have to change them. Then, convert them into the tuktape js, then build the meshagent I'll write a docs later how to do it for you, the is already a few guide in issues explaining how to do it, just can't find links at moment |
I have looked through the code and found all the references, it should be just a case of replacing the wmic commands with native powershell commands but the outputs will need to be checked that they are the same, there is references both in the client and the server so both places will need changed, Im on the unofficial mesh discord if that helps? |
Yeah, mostly they are replaceable with Get-CimInstance, I've run through both the server and the client and found the replacements for each of them. The output formatting is very different, however, so they need to be parsed very differently. The upside is that, with Select-Object, the parsing should actually be much less work. Mostly it's just a matter of getting it built and testing. The only one I haven't found a great replacement with is: Line 31 in 81877a3
My current plan is @si458, there are changes in the modules. I figured out how to get the C built, but I can't figure out how to convert the modules into tuktape; I see that some of the duktape C code contains javascript code as strings, but none of them seem to be the code I'm changing. Is converting a manual process, or is there a compilation tool for that? |
I don't know if this is the correct way, but you can integrate JS modules like this (works in windows powershell).
Paths must be with forward slashes. |
Ah, I didn't consider they might be base64. I had to add "expandedModules" to make it work, but it does work. My concern with this is there are some comments in that file currently, and also some ifdefs, but this method doesn't re-generate them. It kinda looks like those comments might have been added manually, since they aren't wholly consistent, but I'm not sure. Either way, it makes me think this may not be the intended workflow, though it will unblock me for doing the actual important fixes now. I can figure out how to integrate them properly before I PR. |
When installing an agent on Windows 11 24H2 26100 (Early preview), I receive the error:
..\microscript\ILibDuktape_ScriptContainer.c:1667 (0,0) uncaught: ‘cannot read property \x27split\x27 of null
I can't verify for sure that this is coming from WMIC missing because it doesn't give me a stack trace, but meshagent does use WMIC and attempt to parse the results, and it is what is in common with the devices on which I have seen this occur, so it seems probable.
WMIC was deprecated in 2021, and it seems like the chickens are finally coming home to roost on this. It also looks like it may need to be replaced with a powershell script, according to this blog post.
The text was updated successfully, but these errors were encountered: