I am creating a windows utility that, in part, allows the user to activate windows. when I run the command slmgr /ato with system() I get the error "0x80004001 Not implemented (SWbemObjectEx)". When I try to execute the same command from cmd it works fine. It should also be noted that it doesn't fail every time, half of the time it works perfectly fine. At first I thought that perhaps I was executing the commands too quickly in succession, but adding a delay doesn't seem to make a difference.
void activateWindows(char* key)
{
EnableWindow(Main_activate_win, false);
char cmd[41];
sprintf(cmd, "slmgr /ipk %s", key);
system(cmd);
//Sleep(5000);
system("slmgr /ato");
EnableWindow(Main_activate_win, true);
}
EDIT: it seems that it only fails in this way when it is installing onto a machine that previously had a different version of windows installed.