r/PowerShell • u/network_dude • May 17 '26
Question RPC Errors running against computer list
Hi,
I have a script to check a few registry entries
When run at individual machines, the script returns results.
When running against a list of machines in a for-each loop, I get RPC errors.
I paused all the security agents with the same result.
I need some ideas from the hive brain, please, and thank you
edit: This script worked last year against all the servers.
the script
#Test a list of computers
#$computers = Get-Content D:\Scripts\Inputs_WindowsServers.txt
$computers = get-ADComputer -Filter { OperatingSystem -like "*Windows Server*" } | Where-Object { $_.Enabled -eq $true } | Select-Object Name | Sort-Object Name
$Date = Get-Date -format "dd-MMM-yy"
$Data = @(
ForEach($computer in $computers)
{
Test-Pendingreboot -computername $computer -detailed -SkipConfigurationManagerClientCheck
} )
3
u/BlackV May 17 '26 edited May 18 '26
show us your code...
2
u/HumbleSpend8716 May 17 '26
no work shown, please post the script and what you have tried
3
u/arslearsle May 17 '26
Please show code, and full exception/error message
1
u/PinchesTheCrab May 18 '26
I looked at the module, and it already handles an array of computer names. Try taking it out of your loop, my assumption is that something there is going wrong.
That being said, this thing is a bit long in the tooth - still using the WMI cmdlets.
0
u/rsdovers May 17 '26
You may want to ensure that the remote registry service is running on the remote servers. Also, if there is a firewall between the node running the script and the remote servers, the RPC range of ports should be open. This is what comes to mind without knowing more.
0
u/Secret_Account07 May 18 '26
Could be a few things tbh.
As others said- error will help
I manage a large environment with thousands of servers and dozens of domains. My entire life is RPC errors lol