1

From an Outlook macro, I want to run the quser command to get the logon datetime :

Private Sub getLogonDateTime()

    MsgBox CreateObject("WScript.Shell").Exec("quser").StdOut.ReadAll()

End Sub

It works when I'm logged in as admin. When I'm not logged in as admin, I get a runtime error ("file not found").

But quser works in cmd or powershell even if I'm not admin.

Is it some kind of security setting ? How can I read quser result from outlook VBA if I'm not an admin ?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Alsatian
  • 3,086
  • 4
  • 25
  • 40
  • 2
    Those may be a interesting : http://stackoverflow.com/a/17467283/4628637 and https://social.technet.microsoft.com/Forums/scriptcenter/en-US/310e57f9-2367-4293-9f97-53d0e077aacc/vb-script-to-run-a-batch-script-as-admin?forum=ITCG – R3uK May 18 '17 at 14:40

0 Answers0