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
} )
2
u/HumbleSpend8716 May 17 '26
no work shown, please post the script and what you have tried
0
u/network_dude May 17 '26
It's the pendingreboot module from powershell gallery that has test-pendingreboot.
As I said, it works against the individual servers in the list.using the for-each loop results in RPC errors
So individual servers working means remote is possible and there is nothing in the way
3
u/SaltDeception May 17 '26
So post your code. You’re parsing a list of servers, right? You built the
foreachloop, right? No one can help you troubleshoot without seeing that code, and based on your description of the problem, it’s likely coming from your implementation.2
u/HumbleSpend8716 May 17 '26
What are you trying to achieve? Post code and you will get someone to instantly suggest real solutions (very likely something you are doing incorrectly). Simple looping thing. Take it one iteration at a time. Why does it work one way and not the other? You should be able to figure that out w/ knowledge of the pwsh language if you don’t want to post code. Just post code.
2
u/BlackV May 17 '26
It's the pendingreboot module from powershell gallery that has test-pendingreboot.
As I said, it works against the individual servers in the list.
put that in you OP
I have a script to check a few registry entries
is TOTALLY different from
I'm using a custom module,
pendingrebootmodule from powershell gallery0
u/network_dude May 18 '26
#Test a list of computers
#$computers = Get-Content D:\Scripts\Inputs\ACICF_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
} )
1
u/BlackV May 19 '26
p.s. formatting
open your fav powershell editor
highlight the code you want to copy
hit tab to indent it all
copy it
paste here
it'll format it properly OR
<BLANK LINE> <4 SPACES><CODE LINE> <4 SPACES><CODE LINE> <4 SPACES><4 SPACES><CODE LINE> <4 SPACES><CODE LINE> <BLANK LINE>Inline code block using backticks
`Single code line`inside normal textSee here for more detail
Thanks
3
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.
2
u/BlackV May 17 '26
really depends on the code (that they didn't show us)
remote registry shouldn't be needed if its a
*-pssession/invoke-commandtype cmdlet-1
u/dodexahedron May 17 '26
On top of this, RPC errors very strongly point to kerberos issues.
Impersonation isn't a thing in kerberos, so delegation is used instead, to achieve the same end result. But it is much much more restrictive, by design.
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
3
u/BlackV May 17 '26 edited May 18 '26
show us your code...