I am using a PowerShell WSUS update script from this site:
I am running it against an Windows Server 2012 R2 server, which so far as I know has Windows remote management already configured on it, any way I can double-check this??
It does not have any ability to inquire directly on the site.
I get these errors thrown back to me:
Exception calling “Download” with “0” argument(s): “Exception from HRESULT: 0x80240024”
At C:\scripts\wsus_update.ps1:58 char:1
You’d probably be best off contacting the original author of the script.
But, are you running this locally, or remotely? I ask because you mentioned remote management; if you’re triggering this remotely, you’re very probably running into the delegated credential problem that trips everyone up. The script probably can’t run against entirely local resources, and so it fails when triggered remotely. It’d work if run locally, if that was the problem.
Well, for first try, as you can see, I’m running it against $server = ‘sep1’
I started the script from inside the wsus server.
And I at least remember and know that invoke-command is for running stuff remotely against other servers…though I am not an expert on using it…
And I can see that there’s no invoke-command in the script…
I briefly read up on invoke-command and found this snippet:
# PowerShell Invoke-Expression example from .ps1 file
$Path = "C:\PingWeb.ps1"
Invoke-Expression "$Path"
Would this have the effect of running my script remotely if I put a parameter to ask me which server??
Or would invoke-expression run the script against all the servers in the array??
I did not immediately find anything wrt invoke-command that would enable the foreach part to work against different servers…
I’ll also continue researching now that I understand I need some sort of invoke call within a ps1 script to run this script against all the servers…
OK, so here’s the thing. You’re not using Windows Remote Management. Period. You’re using the Microsoft.Update COM object, which only reluctantly works from within PowerShell. Now, I’ll tell you what that author probably meant: There’s a Windows Firewall exception for “Remote Management,” which is probably enabling ports that this COM object needs to talk to on whatever server you target. But that’s got nothing to do with (I know it’s confusing) the Windows Remote Management protocol, and nothing to do with PowerShell Remoting, and nothing to do with Invoke-Anything.
This isn’t really “PowerShell,” you’re connecting to external technologies and they’re doing their thing. Unfortunately, I don’t have enough information to tell you what it failing. The only thing I noticed:
$Downloader = $Session.CreateUpdateDownloader[]
Is that should probably be () not . But I don’t know if that’ll fix what you’re having a problem with at all.
It is () in the script.
The forum pre code thing changed all the parentheses to , I don’t know why…some of them I found and fixed…
I’ll re-edit the script to make sure they are really parentheses then try again one more time then look for another script…
Thank you, Tom
the only way to remotely invoke WSUS related COM methods for .Downloader and .Installer - is to use scheduled task manager. btw, Searcher methods work remotely
Try to remotely add new task to your server that run your script “locally” in context of a server.