Wild guess from a PS noob, but does the user context you’re using on your client to run the script have admin permissions on the remote host?
I had a similar issue to yours: PS script would run on some remote hosts but not all. As soon as I added my service account to the local admins group on the remote hosts, all my “weird” connection issues vanished.
Gordon
From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com>
On Behalf Of Mike Leone
Sent: Thursday, March 31, 2022 10:21 AM
To: NTPowershell Mailing List <ntpowe...@googlegroups.com>
Subject: [ntpowershell] Problems running Get-WUHistory against remote computers
[EXTERNAL]
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntpowershell...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BjJfNmVwQrLYHzMsdF2TGqdvL%2BwWFyEZuGT62SVtTn5Pg%40mail.gmail.com.
Wild guess from a PS noob, but does the user context you’re using on your client to run the script have admin permissions on the remote host?
I had a similar issue to yours: PS script would run on some remote hosts but not all. As soon as I added my service account to the local admins group on the remote hosts, all my “weird” connection issues vanished.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CY4PR07MB3144D944153050AD0FB6C180D3E19%40CY4PR07MB3144.namprd07.prod.outlook.com.
Just spotted this Mike:
https://serverfault.com/questions/737691/firewall-blocking-pswindowsupdate
It’s an older post but towards the bottom, mention is made of this:
You can run PS> enable-WUremoting on the remote host. This will create a new inbound rule called PSWindowsUpdate (RPC Dynamics Ports) which covers all the settings mentioned previously.
Maybe this’ll help.
Gordon
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CY4PR07MB31449208BCE9BC6F4BC312C5D3E19%40CY4PR07MB3144.namprd07.prod.outlook.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BjKp4fzZ5sv_8kyj5DZ88m_EFE1Urk7N07nDwYdxQ-VwA%40mail.gmail.com.
Get-Hotfix
Here’s a code fragment from a function I’ve been working on that may help:
# Assumes $Session contains a New-PSSession object
# Next, check to see if PSWindowsUpdate module is installed and install if not:
$r1 = Invoke-Command -Session $Session -ScriptBlock {
If ($null -eq (Get-Module -Name PSWindowsUpdate -ListAvailable) )
{
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module PSWindowsUpdate -Force
Import-Module PSWindowsUpdate
Enable-WURemoting
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BjKp4fzZ5sv_8kyj5DZ88m_EFE1Urk7N07nDwYdxQ-VwA%40mail.gmail.com.
Here’s a code fragment from a function I’ve been working on that may help:
# Assumes $Session contains a New-PSSession object
# Next, check to see if PSWindowsUpdate module is installed and install if not:
$r1 = Invoke-Command -Session $Session -ScriptBlock {
If ($null -eq (Get-Module -Name PSWindowsUpdate -ListAvailable) )
{
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module PSWindowsUpdate -Force
Import-Module PSWindowsUpdate
Enable-WURemoting
}
}
I don't know if ever happened to you but here is what I have observed with PSWindowsUpdate 2.1.1.2:
remoting to a machine running 20H2 onwards and then executing Get-WUHistory gets the PS session comletely stuck.
Not even an error. Can't get out with CTRL+C and never comes back.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/0906623f-c69d-60bd-d89a-fe03f1b03b39%40univie.ac.at.