Checking for Registry Value Of Computers in an Organizational Unit - powershell

Looking to gather information from Computers in an OU regarding mailboxes that were manually added and not added manually.
I'm pretty sure that the hive I need to target is:
HKCU:\Software\Microsoft\Office\15.0\Outlook\Profiles\Outlook
I'm looking for a value of:
#example.example.edu
If that value is present I'd like it to output that value to a log file along with the user name it's attached to. If it's not present I'd like that outputted to a log file also.
Is test-registry value the right way to go?
How would you get the values for the computers in an OU?
Sorry for all the questions - still learning.

Related

Powershell pass criteria to Out-GridView

Is there any way to run Out-GridView with pre-defined criteria?
I have three columns:
Computer, Source Role and Assignee.
Basically, I'm searching by Computers to see which access group (Assignee column) will give access to the server, but often we're getting requests to give access to many servers at once.
So I'm trying to achieve something like this:
But without the need to specify it manually in the GridView.
Thanks for all the help!

Reading file from Google Drive with Talend

I need to read an uploaded file in Google Drive and perform X transformation with it. As per my reading, the single way to do it is by downloading the file to my local machine with the Talend component and then, reading from there.
If it is correct, I cannot figure what would be the file name assuming that I don't want to use the exact name of the file.
I found http://meowbi.com/2018/02/23/getting-google-sheet-gdrive-talend/ and it is exactly what I need - read from Google Drive, check the file name and proceed if the file name is X. What is unclear for me is what they used in tJava.
The output schema of tGoogleDriveList component's Main row contains a field name that is the file name you're looking for. Using Iterate row is less straightforward as you need to extract values from GlobalMap. In the article you cited they get file name by "tGoogleDriveList_1_TITLE" key of the GlobalMap.
Main row between tGoogleDriveList and tJava
For more details please look into the Talend Reference for Google Drive components. The Listing files and folders in Google Drive section should be particularly topical for your case.

Powershell AD tool

Basically, I've created a 400+ and growing AD tool with a GUI. I've given them the option to search using many filters with get-aduser and wild cards fill the rest. This company is large so when I search for a common name like kyle or john, it takes along time to pull the information because the search was not specific.
Is there a way to stop them from doing such a general search or limit the number of entries can be in an array, or stop the search if there's too much information.
Edit: I have a solution using a variable to count wild cards but that only works if the form is completely blank. If i set the number any different they won't be able to look someone up by ID number

PS Active Directory per user login count

I've been looking for a solution but cannot find anything easy enough or reliable, so please excuse for bringing this up again.
In a typical AD environment, what I want to get is a monitoring report that would say something in the lines that "user X has logged in YYYY times in the past ZZ period".
The lastlogon date on get-aduser in PS is the only thing I can find, as that changes with each login, but cannot be easily scripted in a scheduled run to generate a report for eg.
Has anyone implemented this or use any tools that can track this?
There's only one reliable way to do what you want: collect and parse the audit logs from all Domain Controllers.
If you have a few users that you want to keep track of over time, an alternative could be monitoring the sum of the logonCount values for that user. Since the logonCount attribute is not replicated, you will have to collect it from each DC per user, then calculate the difference.
You can probably check the AD replication logs for replication of changes to the lastlogontimestamp property.
This script will do what you want for a particular user - closest I've managed to come so far.

Powershell - Copying CSV, Modifying Headers, and Continuously Updating New CSV

We have a log that tracks faxes sent through our fax server. It is a .csv that contains Date_Time, Duration, CallerID, Direction (i.e. inbound/outbound), Dialed#, and Answered#. This file is overwritten every 10 minutes with any new info that was tracked on the fax server. This cannot be changed to be appended.
Sometimes our faxes fail, and the duration on those will be equal to 00:00:00. We really don't know if they are failing until users let us know that they are getting complaints about missing faxes. I am trying to create a Powershell script that can read the file and notify us via email if there are n amount of failures.
I started working on it, but it quickly became a big mess as I ran into more problems. One issue I was trying to overcome was having it email us over and over if there are certain failures. Since I can't save anything on the original .csv's, I was trying to preform these ideas in the script.
Copy .csv with a new header titled "LoggedFailure". Create file if it doesn't exist.
Compare the two files, and add different data (i.e. updates on the original) to the copy.
Check copied .csv for Durations equal to 00:00:00. If it is, mark the LoggedFailure header as "Yes" or some value.
If there are n amount of failures, email us.
Have this script run as a scheduled task (every hour or so).
I'm having difficulty with maintaining the data. I haven't done a lot of work with scripting or programming, so I'm having trouble with making the correct logic. I can look up cmdlets and understand them, but my main issue is logic. Does anyone have any tips or could provide some ideas on how to best update the data, track failures as to not send duplicate information, and have it run?
I'd use a hash table with the Dialed# as the key. Create PSCustomObjects that have LastFail date and FailCount properties as the values. Read through the log in chronological order, and add/increment a new entry in the hash table every time it finds an entry with Duration of 00:00:00 that's newer than what's already in the hash table. If it finds a successful delivery event, delete the entry with that Dialed# key from the hash table if it exists.
When it's done, the hash table keys will be a collection of the Dialed numbers that are failing, and the objects in the values will tell you how many failures there have been, and when the last one was. Use that to determine determine if an alert needs to be sent, and what numbers to report.
When a problem with a given fax number is resolved, a successful fax to that number will clear the entry from the hash table, and stop the alerts.
Save the hash table between runs by exporting it as CLIXML, and re-import it at the beginning of each run.