Skip to content

Instantly share code, notes, and snippets.

@jonman364
Created November 4, 2014 14:29
Show Gist options
  • Select an option

  • Save jonman364/74c425d7bd279d7a6531 to your computer and use it in GitHub Desktop.

Select an option

Save jonman364/74c425d7bd279d7a6531 to your computer and use it in GitHub Desktop.
#include <windows.h>
int WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdLn, int nShow){
char cmd[] = "nltest.exe /sc_change_pwd:DOMAIN"; // Change DOMAIN to domain name
PROCESS_INFORMATION procInfo;
STARTUPINFO startupInfo;
ZeroMemory(&startupInfo, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
//chdir("%windir\\Sysnative");
Wow64DisableWow64FsRedirection(NULL);
if(CreateProcess(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &startupInfo, &procInfo)){
WaitForSingleObject(procInfo.hProcess, INFINITE);
CloseHandle(procInfo.hThread);
CloseHandle(procInfo.hProcess);
}
return 0;
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="requireAdministrator">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>
</assembly>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment