osx - Remotely query logged in Open Directory users from PowerShell (find if user logged into machine) -
i in mixed environment both macos (osx) , windows, dual booting on our client machines. have open directory , active directory running. macos connects od, windows ad.
for our computers, wanna know os have booted (if any) , if there user logged on. should done remotely (for example our ad-server).
i wrote script in powershell gets list of our machines active directory , tests if online (via test-connection
). tries get-wmiobject
each machine online test if booted windows , if there logged on user. if online, get-wmiobject
cannot connect, assume booted macos.
the question is: how can i, powershell, find out if user logged macos machine, either remotely querying respective machine or our open directory?
if on mac should able run command:
last | grep "logged in"
and should show there. since know works, can use powershell determine if computer on windows or mac environment variables available. if run this, pointed @ appropriate scripts, should solve issue seeing.
if ($isosx) { .\callshell.sh } elseif ($iswindows) { .\callposh.ps1 } else { throw "oh boy bad" }
let me know if works!
Comments
Post a Comment