This project is read-only.

Approval thinks my server is in replica mode

Sep 9, 2015 at 3:43 PM
Edited Sep 9, 2015 at 3:46 PM
I am working to create a script that gives me a list of all needed, unapproved updates for a particular computer group. It queries for this on three WSUS servers, one being autonomous and two being that server's replicas and produces a consolidated list of unique updates.

I then, while still connected to the autonomous server, which I query last, have the script do this:
foreach ($updateTBA in $updatesTBA)
        $updateTBA |Where-Object {$_.IsSuperseded -eq $false} |Approve-PoshWSUSUpdate -Action Install -Group $wsusGroup
Yesterday, I got the whole script to a work perfectly and used it to approve needed updates for two different computer groups. It worked without a hitch. I was a happy scripter.

Today, I am attempting to do it again, same script, no changes to the environment whatsoever and I get an error:
Exception calling "Approve" with "2" argument(s): "Cannot perform this action when the server is in replica mode"
At C:\Users\(...)\Documents\WindowsPowerShell\Modules\PoshWSUS\Scripts\Approve-PoshWSUSUpdate.ps1:155 char:21
+                     $Data = $patch.Approve($action,$targetgroup)
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException
I have tried adding explicit Disconnect-PoshWSUSServer commands without it correcting the problem, I thought perhaps the script is for some reason still connected to one of the replicas. But no, that did not help.

I am just starting out with my work controlling WSUS using PowerShell scripts and I'd be really grateful for any assistance here. Why is the script under the impression my server is a replica when it really isn't?


P.S.: I should add that approving updates on the autonomous server using the WSUS console works fine, no complaints about it being in replica mode.
Sep 9, 2015 at 5:31 PM
Hold on, I think I see the problem. the updates contain an updateserver property that retains in this case, the replica server from where it came, I thought it would just pass on the GUID, but it seems somehow it tries to go to the original server and approve it there, instead of on the autonomous server I am connected to when trying to approve.

I guess my nice script only worked because yesterday all needed updates just happened to be found on the autonomous server. :(

back to the drawing board.