Forum Discussion
drawson
Aug 09, 2019Brass Contributor
Inventory SSL Root Cert Remotely Using PowerShell
I am not well versed with PowerShell but after researching it appears PowerShell might be the tool I need. I have a need to inventory all computers on my AD to confirm whether or not they have the necessary SSL root certs that I have attempted to push out via GPO.
Most computers do have the certs but I need to identify the ones that do not.
All examples I've run across seem to include "Path Cert :\localmachine". How do I replace 'localmachine' for 'computer name' to gather SSL cert info from remote computers on my LAN?
One example but it is not entirely clear how I would modify this script to connect remotely to each machine:
Get certificate info into a CSV by using PowerShell
Using PowerShell to work with SSL Certificates
8 Replies
Sort By
- LainRobertsonSilver Contributor
Hi, Asif.
You don't need a UNION - it's much easier to do what you're asking than that.
SELECT [a].* FROM myTable AS [a] WHERE COALESCE([a].[updatedDate], [a].[createdDate]) > 'some DateTime value';
Cheers,
Lain
- Neils2401Copper Contributor
Thanks Lain,
The 'Some dateTime value' you are saying in the query will be vmaxUpdatedDate or vmaxCreatedDate ? Which max date I should pick that I do not loose the incremental data.And below are some more details
The dates are captured at the point of time, when new rec is inserted or updated. I do not have much control over source table & DB, I am only allowed to select.
The dateCreated is datetime2 and UpdatedDate datetime filed, when I query I see it has date value along with timestamp for both the fields.
I see that along with PK the DateCreated is not null and UpdatedDate can be null, UpdatedDate will only have values when the rec is updated later after being inserted. Hence I am requested to pull the incremental data based on UpdatedDate and if this col has NULL then take DateCreated
- LainRobertsonSilver Contributor
The 'some DateTime value' is the value you're keeping track of external to the table itself. You could be saving it entirely external in something like a cookie, an XML file, or even internal to a database - whether that's the source database or another one.
Ultimately, you will have to keep track of the last timestamp you queried against so that your next query uses that value as it's "from" point of reference.
You don't need any form of control over the source database itself whatsoever. Read-only access is fine for the scenario you've described.
The COALESCE statement takes care of arbitrating between updatedDate and creationDate. Have a read of it to learn more about how it works, but the short description in the context if your example is that it will first look at updatedDate and return that value if it is not null. If updatedDate is NULL, then it will return createdDate.
Cheers,
Lain