We help IT Professionals succeed at work.
Get Started
Troubleshooting Question

PowerShell script help to find a specific software installed in all DCs in the forest

54 Views
Last Modified: 2021-03-21
Hello Experts and PowerShell Gurus.

I need from your expertise to complete a script that should return in a display format (HTML or CSV), a list of software deployed on each domain controller of the organization. The script should verify that a third party software is installed, the registry key is properly created under HKLM, and specific DLL from the third party run is running.

As for the third party solution(Password policy enforcer) deployed on each DC, there are generally no processes or executables running for PPE. It's a DLL called PPE.DLL that gets loaded by LSASS. There is a PPE Mailer service (PPEMail.exe) that may be running on one of your servers (may not be a DC), but PPE itself is all in PPE.DL

More importantly, I need to loop or improve my commands below into a foreach that searches every single domain controller for that software.

My code below:

# To get a domain controller list, grouped by operating system run cmdlet below

$DCs=(Get-ADForest).Domains | %{ Get-ADDomainController -Filter * -Server $_ } | Select-Object Hostname,OperatingSystem,Domain | Sort-Object OperatingSystem,Hostname,Domain | Format-Table Hostname -GroupBy OperatingSystem

# To verify if PPE.DLL is loaded by LSASS
Get-Process lsass -Module | ? {$_.FileName -like "*\PPE.DLL"}

The  two commands above worked fine on my forest AD, however the next command does not return any values, but it runs without any issues. Please, refer to attached screenshot

# Registry key path where software has been deployed

Get-ItemProperty HKLM:\Software\Anixis\* |  Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

As per screenshot attached, no values are returned after running cmdlet above

# Installation path of the third party software

C:\Program Files (x86)\Password Policy Enforcer\PPEConf

From screenshots, you can see, there are approximately 40 DCs that should have that software deployed and the DLL loaded. Having said that your help consist is 4 items below:

1. Consolidate all cmdlets above/below into a single script to be executed from a member server against all DCs from the organization.

2. Determine why Get-ItemProperty HKLM cmdlet is not returning any values. Check screenshots for reference,

3. Include in the final script a code that allows me to export all final info to a nice HTML page and also CSV file.

4. Validate if the following cmdlet below to invoke command, I need to include every single DC name on the line. We currently have 40 DCs in the forest, if there is another way to accomplish this task without entering all servers names in the code, please let me know and include on your final script

# To check software installed on all DCs from a jump or member server

Invoke-Command -cn server1, server2 -ScriptBlock {Get-ItemProperty HKLM:\Software\Anixis\* | select DisplayName, Publisher, InstallDate }

Please, do not suggest to check other URLs such as https://devblogs.microsoft.com/scripting/use-powershell-to-find-installed-software/


Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE