in reply to Win32::OLE and Wscript Shell -> Getting data back

Why are you using Win32::OLE as a replacement for the system function or backticks?

  • Comment on Re: Win32::OLE and Wscript Shell -> Getting data back

Replies are listed 'Best First'.
Re^2: Win32::OLE and Wscript Shell -> Getting data back
by Gaz5 (Novice) on Jun 14, 2010 at 12:22 UTC

    Ordinarily thats (backticks) exactly what I'd do, but you cant use runas (AFAIK) with backticks without the program prompting the user for the password. I want the password to be automatically supplied when requested by runas - hence the need for win32::ole.

    Unless you know another way?

      Short googling for runas without password suggests psexec via ExpertSexChange, to which you can supply the username and password directly. Likely you can achieve the same using a Perl module, but I haven't had the need yet.

        I did use google (extensively) and this site before posting. Give me some credit! :-)

        Despite a few weeks work of searching I haven't found a way do do via any other Perl module than Expect - which doesn't work on a Windows system due to IT::Tty being unavailable.

        In terms of psexec, it'll do exactly the same as my script, except mine doesn't need another exe bundled with it. The problem remains though: all I'll get back from it is that psexec completed with error code 0. I wont actually get the return code back from net send, which is my problem, not making the script run as someone else, that part works fine.