Skip to content

Instantly share code, notes, and snippets.

@dhval
Last active August 23, 2022 13:47
Show Gist options
  • Save dhval/edf77c0bced66303f1bb to your computer and use it in GitHub Desktop.
Save dhval/edf77c0bced66303f1bb to your computer and use it in GitHub Desktop.
WINEXE: A PSEXEC-LIKE CLIENT FOR ACCESSING WINDOWS FROM LINUX

#### Execute cmd on remote windows machine using winexe utility.

winexe --user domain\user --password=password //remotehostip cmd.exe

If you get errors like ERRDOS:ERRnomem

1.) Update windows 7 registry.


#####winexe.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters] "Size"=dword:00000003

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] "LargeSystemCache"=dword:00000001


or windows command line

reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters /t REG_DWORD /v Size /d 00000003 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /t REG_DWORD /v LargeSystemCache /d 00000001 /f

/v The value name, under the selected Key, to add /t RegKey data types [ REG_SZ | REG_MULTI_SZ | REG_DWORD_BIG_ENDIAN | REG_DWORD | REG_BINARY | REG_DWORD_LITTLE_ENDIAN | REG_NONE | REG_EXPAND_SZ ] If omitted, REG_SZ is assumed /d The data to assign to the registry ValueName being added /f Force overwriting the existing registry entry without prompt

2.) Restart services

net stop browser
net stop lanmanserver
net start lanmanserver
net start browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment