Skip to content

Commit

Permalink
replace wmi service with net
Browse files Browse the repository at this point in the history
  • Loading branch information
si458 committed Nov 3, 2024
1 parent 3890ea2 commit d08c5ce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion meshcore/agentcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,8 @@ void MeshServer_selfupdate_continue(MeshAgentHostContainer *agent)
ILibUTF8ToWideEx(agent->exePath, (int)strnlen_s(agent->exePath, 4096), w_exepath, 4096);

swprintf_s(cmd, MAX_PATH, L"%s\\system32\\cmd.exe", env);
swprintf_s(parms, 65535, L"/C wmic service \"%s\" call stopservice & \"%s\" -b64exec %s \"%s\" & copy \"%s\" \"%s\" & wmic service \"%s\" call startservice & erase \"%s\"",
// get-ciminstance win32_service -filter "Name='this.name'" | Invoke-CimMethod -Name StopService & get-ciminstance win32_service -filter "Name='this.name'" | Invoke-CimMethod -Name StartService
swprintf_s(parms, 65535, L"/C net stop \"%s\" & \"%s\" -b64exec %s \"%s\" & copy \"%s\" \"%s\" & net stort \"%s\" & erase \"%s\"",
w_meshservicename,
w_updatefile, L"dHJ5CnsKICAgIHZhciBzZXJ2aWNlTG9jYXRpb24gPSBwcm9jZXNzLmFyZ3YucG9wKCkudG9Mb3dlckNhc2UoKTsKICAgIHJlcXVpcmUoJ3Byb2Nlc3MtbWFuYWdlcicpLmVudW1lcmF0ZVByb2Nlc3NlcygpLnRoZW4oZnVuY3Rpb24gKHByb2MpCiAgICB7CiAgICAgICAgZm9yICh2YXIgcCBpbiBwcm9jKQogICAgICAgIHsKICAgICAgICAgICAgaWYgKHByb2NbcF0ucGF0aCAmJiAocHJvY1twXS5wYXRoLnRvTG93ZXJDYXNlKCkgPT0gc2VydmljZUxvY2F0aW9uKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgcHJvY2Vzcy5raWxsKHByb2NbcF0ucGlkKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcm9jZXNzLmV4aXQoKTsKICAgIH0pOwp9CmNhdGNoIChlKQp7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQ==", w_exepath,
w_updatefile, w_exepath, w_meshservicename, w_updatefile);
Expand Down
Loading

0 comments on commit d08c5ce

Please sign in to comment.