Good afternoon all.
Let me start off by saying I appreciate all the assistance whenever I ask a question, and I promise I am trying to brush up on my PS, but it's a lot slower than I thought it would be.
However, your answer assistance helps me put together and modify scripts that I need for my environment as well. :-)
I need to know how to do the following.
I need to know how to load all servers from A/D, and then run the following command:
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.Publisher -contains "AUTHOR" } |
Select-Object DisplayName, $PSPath
That command on a server would result in the following as an example:
Some A/D joined servers could have less, some could have more.
Then it would write the file to either a comma or other some sort of delimited file.
with the server name (either A/D Common Name, or FQDN), and those lines of results.
I would appreciate it if someone could point me in the right direction of how to get started with that, and then I can modify it later as needed.
I have tried the following, and it keeps prompting for "process[0]:", so obviously I have something in the wrong place:
import-csv C:\Temp\computerlisting.csv |
foreach {
$ScriptBlock = {Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" |
Where-Object { $_.Publisher -contains "AUTHOR" } |
Select-Object DisplayName, DisplayVersion}
Invoke-command -ComputerName $_.name -ScriptBlock $ScriptBlock
}
$result
Thank you again!
