dlynas Posted July 23, 2007 Share Posted July 23, 2007 I am trying to run part of the pstools kit on a webpage - It is a web-based computer management system, so for it lists all computers in a OU and their MAC address and their is the ability to WOL them, i want to run psloggedon which returns who is logged onto the machine from a php page but do not know how to do with a return the result, psloggedon take the computername as a parameter. Can anyone help me please? Quote Link to comment Share on other sites More sharing options...
trq Posted July 23, 2007 Share Posted July 23, 2007 What would the command you want to run look like when placed in a term? Quote Link to comment Share on other sites More sharing options...
dlynas Posted July 23, 2007 Author Share Posted July 23, 2007 Basically at a command prompt you type psloggedon \\computername and it returns the users that are logged on, i want to be able to use this on a webpage to print the result to the screen Quote Link to comment Share on other sites More sharing options...
trq Posted July 23, 2007 Share Posted July 23, 2007 <?php function psloggedon($pcname) { return shell_exec("psloggedon \\\\$pcname"); } echo psloggedon('foo'); ?> Quote Link to comment Share on other sites More sharing options...
dlynas Posted July 23, 2007 Author Share Posted July 23, 2007 Thanks for your reply, where does the 'foo' come from? Quote Link to comment Share on other sites More sharing options...
trq Posted July 23, 2007 Share Posted July 23, 2007 That is just a fictional computer name I used as an example. Quote Link to comment Share on other sites More sharing options...
dlynas Posted July 23, 2007 Author Share Posted July 23, 2007 Yeah i just got it, i have tried it, its runs without any errors but doesnt return anythign to the screen? Quote Link to comment Share on other sites More sharing options...
trq Posted July 23, 2007 Share Posted July 23, 2007 its runs without any errors but doesnt return anythign to the screen Alot of shell apps do so when there are errors. What do you get when you type that exact command at the term, and can we see the exact command you used. Quote Link to comment Share on other sites More sharing options...
dlynas Posted July 23, 2007 Author Share Posted July 23, 2007 the command is psloggededon \\computername It returns N:\Tools\TNT\geeky\PsTools>psloggedon \\rowlands PsLoggedOn v1.31 - Logon Session Displayer Copyright © 1999-2003 Mark Russinovich Sysinternals - www.sysinternals.com Users logged on locally: <Unknown> NT AUTHORITY\LOCAL SERVICE <Unknown> NT AUTHORITY\NETWORK SERVICE <Unknown> HELESSCHOOL\ROWLANDS <Unknown> NT AUTHORITY\SYSTEM Users logged on via resource shares: 23/07/2007 15:08:53 LYNAS\LYNAS When run from command prompt - i have point the script to the correct location of the psloggedon exe Quote Link to comment Share on other sites More sharing options...
trq Posted July 23, 2007 Share Posted July 23, 2007 When run from command prompt - i have point the script to the correct location of the psloggedon exe Then you need to do that here aswell. <?php function psloggedon($pcname) { return shell_exec("N:\Tools\TNT\geeky\PsTools\psloggedon \\\\$pcname"); } echo psloggedon('foo'); ?> Quote Link to comment Share on other sites More sharing options...
dlynas Posted July 23, 2007 Author Share Posted July 23, 2007 Yes i have changed the php script to look at a directory where the exe is already Quote Link to comment Share on other sites More sharing options...
trq Posted July 23, 2007 Share Posted July 23, 2007 Sorry, you'd need to use.... return shell_exec("N:\\Tools\\TNT\\geeky\\PsTools\\psloggedon \\\\$pcname"); Damn windows sucks. Quote Link to comment Share on other sites More sharing options...
dlynas Posted July 23, 2007 Author Share Posted July 23, 2007 Yes, yes it does, but still no output Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.