wintest for testing Samba against windows
Sam Liddicott
sam at liddicott.com
Wed Nov 24 10:56:35 MST 2010
As my final post in the winexe saga; as the --runas seems to do nothing,
and as it can't seem to launch on console 1 (the main desktop) [maybe
the same bug] here are some spells that use psexec on the windows
machine to actually get the runas effect and running apps on the console 1.
Note that mapped network drives won't work for programs so-launched, but
this is nothing to do with winexe, psexec to local host has the same
problem, however you can re-call "net use" and re-map the same drive and
it works.
W_PASSWORD='test-password1'
W_DOMAIN='TESTSMB'
W_USER='$W_DOMAIN\Administrator'
W_SERVER=win2008r2
W_PSEXEC='c:\test\pstools\psexec.exe'
W_COMMAND="cmd.exe"
W_DESKTOP=1
W_WRAP_COMMAND="$W_PSEXEC "'\\'"$W_SERVER -u $W_USER -i $W_DESKTOP -p
$W_PASSWORD $W_COMMAND"
./winexe -U "$W_USER" --password="$W_PASSWORD"
--runas="$W_USER%$W_PASSWORD" --interactive=1 "//$W_SERVER"
"$W_WRAP_COMMAND"
if W_DESKTOP=1 then W_CMD is started on the console, otherwise in the
service desktop for which any programs started from the service desktop
without using psexec wrapper don't get a proper event loop and can't
paint, but starting notepad or explorer.exe from the cmd.exe that is
started from psexec that is started from winexe (!!) will work; so you
can (by starting explorer.exe) have a full desktop session running in
the service window (I guess tightvnc will show it too). (Sometimes you
have to wait for the "interactive services dialog detection" to pop up
and switch you to the service desktop.
e.g.
W_COMMAND='cmd.exe /c c:\windows\system32\notepad.exe'
W_COMMAND='cmd.exe /c explorer.exe'
W_COMMAND="cmd.exe"
W_DESKTOP=0
So... now I can start a fresh desktop (or use the logged in one) to do
my testing with, all from the linux command line.
Sam
More information about the samba-technical
mailing list