Perl code to retrieve currently logged user list of windows server - perl

Clients are connecting to a windows server with different user names. For example:
client1 connects to server with user1
client2 connects to server with user2
client3 connects to server with user3
Now there are 3 currently logged users at server: user1, user2, user3.
Is it possible retrieve logged on users and client name? I can see this at task manager at user form as seen at below picture:

I don't use Windows, but I can Google enough to guess at a solution.
This page suggests that you can use query user to get a list of logged in users.
You can run that command in Perl and capture the output using qx[].
# All output in a scalar
my $users = qx[query users];
# One line of output per element in an array
my #users = qx[query users];
You know have the information that you want in a Perl variable. The next step is to parse that data to extract the specific fields that you need. As I don't currently have access to a machine running Windows, I can't see what format this command returns, so I can't help you with this second part of the process.
If you have trouble parsing the data, then post a sample of it in a new question here and we'll be happy to help you further.

Related

Is it possible to pull certain information from "Net User Query (Username) /dom" through powershell 5.1?

I'm taking calls at a Helpdesk, and I use PowerShell 5.1 (in restrained language mode with no access to additional modules), running "net user query (username) /dom" for every call.
I'm trying to create a script that makes this process easier and wanted to create a function with the result that I get, but am unsure how to.
How do I select a specific result that comes from the information once net user query command is completed? such as attribute "Full name" and "account log in status"? Is this possible without having any modules installed?
I was hoping to create a variable from the results of some of the information that is returned and then plug them in to other commands.

How can I use the PowerShell command "Get-AdminPowerAppsUserDetails" for ALL the users

I need to get (in PowerShell) the las time a user used a PowerApp.
I can get that information from the command Get-AdminPowerAppsUserDetails, but that command gives you the data of only one user, and the output is only directed to a file (that´s the way the command works).So If I want the data of all the users in the tenant, I need to create a loop through the users list, call that command for every user, and I must create an output file for every user. Finally I have to concatenate all the users in a single file, and then parse the info.
Is there a better way to get that information instead of calling Get-AdminPowerAppsUserDetails for every user and get those huge amount of files?

Multiple FMP sessions on a filemaker server

I am a FMP server novice but I have a solution that I'm interested in hosting it online via instant web publishing. It's dependent on a user_id being held in a global variable through the life of the session (e.g. log in, cache user_id, use user_id through the session).
This is obviously fine in a single instance, but I'm wondering how the server will handle it if another session starts ... is it able to run multiple session instances? (e.g. I have 2 users logged into two parallel running sessions, with 2 instances of user_id, both holding unique values)
I'd appreciate your thoughts.
with thanks
Giles
Global variables (and global fields) are global only for a login. They are not pushed to the server and will not affect other sessions. So your user_id example should work fine.
FileMaker's help probably puts it best:
Global field values are global to the user, not to the database. Each guest maintains values in their global fields separate from other guests.
When a guest opens a file, the global field values are copied from the values for the host into the guest. If the guest's global field values are then changed, such as by running a script, they are changed just for that guest. They are not changed for the host or any other guests.
source: http://help.filemaker.com/app/answers/detail/a_id/3604/kw/3604

Working with Google Cloud Print

I have begun digging around in the Google Cloud Print project in hopes of creating a custom application for my network. I have a Windows Print Server running with a printer queue I wish to submit jobs to. Setup the Google Cloud Print with the Crome browser and I was able to submit and print jobs just fine. However, my end goal is a little more complicated.
I need to customize the access control from the server-side client endpoint once the job reaches my network. Meaning, once the job is submitted, I need to be able to check the username of the owner of the job and process accordingly. From the looks of it, the /fetch interface does not store the original owner of the job, just the end owner of the queue it ends up on. Meaning, User A has the Google Cloud Printer linked to their account and has shared it with User B. User B submits a job to the shared queue. When I run /fetch on the shared printerID the user is User A.
Has anyone else dabbled with this?
Thanks
Take a look at the ownerId of the job.
The /fetch call does in fact return a user field containing the owner of the printer (User A), but the specific job(s) returned contains an ownerId field with a value of the user that submitted the print job (User B).
Hope that helps.
Following is a partial response from a /fetch call, including ownerId of the job. Keep in mind that this could be one of many jobs that are returned in the jobs array:
...
updateTime: "1403628993840",
status: "QUEUED",
ownerId: "rpreeves#gmail.com",
rasterUrl: "https://www.google.com/cloudprint/download?id=5ca7b1e4-c533-c42b-7d2b-efb862c4215a&forcepwg=1",
ticketUrl: "https://www.google.com/cloudprint/ticket?format=ppd&output=json&jobid=5ca7b1e4-c633-c42b-782b-efb862c4215a",
printerid: "f33c6ff8-fc25-7075-249b-ab65c3e2354e",
...

Facebook Messages access via imap

Does anybody know if is possible to access facebook messages via imap or pop to manage facebook messages within an email client?
No, this is not possible. Only the publicly documented APIs are available.
See especially the inbox connection of the User object
This Article propose a way to read and store facebook message:
The process is done through the following steps:
Logging in : Logging in might be one of the trickier parts. The way you login to an IMAP server is to use the following command:
LOGIN username password
Listing folders : The command you’d issue to the IMAP server is:
LIST "" *
Since we know from the Mailbox folder API description, there are only
three folders. These folders are:
Inbox (folder_id 0)
Outbox (folder_id 1)
Updates (folder_id 4)
With this in mind, we can hard code the following response to the list
command:
LIST (\HasChildren) "/" Inbox
LIST (\HasChildren) "/" Outbox
LIST (\HasChildren) "/" Updates
Selecting a folder : In IMAP, you use the following command to select a folder:
SELECT folder-name
Getting message content: The key in getting messages trough IMAP is a command named FETCH. The FETCH command comes with a lot of
different modes, but we’ll focus on the most fundamental ones. These
are (AFAIK) FLAGS, RFC822, RFC822.HEADER, RFC822.TEXT, RFC822.SIZE and
UID. Since RFC822 is just RFC822.HEADER and RFC822.TEXT combined, we
have one less variable to worry about.
FETCH UID Let’s start with UID, as this is the easiest one. You’d issue this command as follows:
FETCH 1:6 (UID)
The expected result would look something like this:
1 FETCH (UID 1029955483)
2 FETCH (UID 1029955484)
3 FETCH (UID 1029955485)
4 FETCH (UID 1029955486)
5 FETCH (UID 1029955487)
6 FETCH (UID 1029955488)
The equivalent command in Facebook’s API would be something like this
(I’m not sure if it’s possible to combine queries like this, but you
get the idea):
SELECT message_id FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0)
You would then use that output as the UID.
More operations are available in http://www.emailserviceguide.com/2010/01/making-facebooks-messaging-system-imap-compatible/