I have a task which requires me to update a windows service. This service could be under different names - it asks for the install name upon installation of the service... but the Windows Event Logs are hard-coded to a specific name in C#:
if (!EventLog.SourceExists("MySuperSpecialEventLog"))
EventLog.CreateEventSource("MySuperSpecialEventLog", "MyLog");
How can I find all servers with events logged to this custom log?
I've been toying with Powershell:
clear
import-module ActiveDirectory;
$servers = Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*"} -Property Name | Sort-Object name | Format-Table Name; #,OperatingSystem,OperatingSystemServicePack;
$servers
foreach($server in $servers){
echo "Get-Eventlog -List -ComputerName $server"
}
This gives me a list of servers... then I'm trying to pull a list of Services ForEach server... then I can just filter...
But I can't seem to get the thing to click on all cylinders.
If powershell isn't the right tool - what else would work to find all servers with that specific EventLog?
foreach($server in $servers)