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

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?

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 to get user context / thread id to distinguish between task sequences

I have a task sequence to execute multiple times, with multiple different users. Is there something I can write into the log file to identify an action being taken by user1 vs user2?
It kind of depends on exactly what you're trying to do, but the easiest way is probably to just name your request differently, using the name= parameter. (assuming you dont have lots of users)
e.g
self.client.post("/login", data={ "username": username }, name=f"/login {username}")
What I did was to add in my output to a custom CSV file the login id for the user, and an iteration counter. This way I can uniquely distinguish between task sequences because they are identified by email address and the counter.
This works for non-distributed testing.

CQRS - How to handle if a command requires data from db (query)

I am trying to wrap my head around the best way to approach this problem.
I am importing a file that contains bunch of users so I created a handler called
ImportUsersCommandHandler and my command is ImportUsersCommand that has List<User> as one of the parameters.
In the handler, for each user that I need to import I have to make sure that the UserType is valid, this is where the confusion comes in. I need to do a query against the database, to get list of all possible user types and than for each user I am importing, I want to verify that the user type id in the import matches one that is in the db.
I have 3 options.
Create a query GetUserTypesQuery and get the rest of this and then pass it on to the ImportUsersCommand as a list and verify inside the command handler
Call the GetUserTypesQuery from the command itself and not pass it (command calling another query)
Do not create a GetUsersTypeQuery and just do the query results within the command (still a query but no query/handler involved)
I feel like all these are dirty solutions and not the correct way to apply CQRS.
I agree option 1 sounds the best but would maybe suggest adding a pre handler to validate your input?
So ImportUsersCommandHandler deals with importing you data (and only that) and add a handler that runs before that validates (in your example, checks the user types and maybe other stuff) and bails out of it does not pass. So it queries the db, checks the usertypes and does whatever it needs to if it fails. Otherwise it just passes down to your business handler (ImportUsersCommandHandler).
I am used to using Mediatr in NET Core and this pattern works well (this is what we do) so sorry if this does not fit with your environment/setup!

Retrieve all accesses from a certain group/project in MicroStrategy

For audit purposes, I am in need of an export from MicrcoStrategy -that could retrieve to a .csv for example- all accesses from a certain group/project, so I can match´em with a report from Active Directory. Is there any way?
Thanks!
I believe Command Manager has a way to do this. Command Manager has a built-in list of command that you can run against your projects/I-server/etc. There should be something like LIST ALL PRIVILEGES ... or LIST ALL PERMISSIONS ... as a part of that.

Perl code to retrieve currently logged user list of windows server

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.