Moving approved update from Test group to Production group

Aug 12, 2014 at 10:57 AM

PoshWSUS is lovely and lets me make lot of great reports on what I've got approved in WSUS.
Now what I'd really like is a nice example of how to take a set of approved updates from a test group to a production group.

Sadly I'm not a very code inclinded person and only just starting to get to grips with Powershell properly.

I can use the information in the other thread to get my list of updates but I'm struggling to pipe it into Approve-PoshWSUSUpdate. I just get errors. I'm sure there is an easy way of handling this either reading in the input with get-content from a text file or better yet reading from a variable created with Get-PoshWSUSUpdateApproval.

Any examples or pointers much appreciated.

Sep 11, 2014 at 2:23 PM
Hi All,

this is a scenario we are interested in solving via script as well. Our current routine is to approve patches to the WSUS-Group "Test" and let it roll for a week or so, and then approve them (hopefully the same ) to production groups with names corresponding to each weekday patches are installed, ie Monday through Friday.

I saw Boe's script for approving all patches according to specific dates here and i am currently fiddling with it to get what i want. But since my Powershell-skills lacks some depth, all help is appreciated!

Oct 23, 2014 at 5:48 AM
Edited Oct 23, 2014 at 6:03 AM
Hi there,

this is i ended up doing it for the moment, it does what it is supposed to and makes me happy. It's not beautiful or complete in any way though ;-)
$FromCreationDate = [datetime]"2014-10-09"

(Get-PoshWSUSUpdateApproval -UpdateScope (New-PoshWSUSUpdateScope -FromCreationDate $FromCreationDate -IncludedInstallationStates $InstallState) | ´
where { $
.TargetGroup -eq $OriginGroup }).GetUpdate() |´
Approve-PoshWSUSUpdate -Action Install -Group $TargetGroup
Hope this can give you some inspiration for figuring this out in the best way possible for your requirements.

Feb 24, 2015 at 5:46 AM
A small update with a function to copy approvals from group to another. I hope it can be useful to someone at least! Some comments in the code, otherwise ask!
Function Set-WSUSApprovals
    param (
        [parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][string]$Pattern, #Set the target group to approve updates on
        [parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][string]$SourceGroupName, #Set the default Source Groupname to get previously approved updates from
        [parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][string]$CreationDate=(Get-Date -day 1 -hour 0 -minute 0 -second 0), #Set a default CreationDate, start of month
        [parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][string]$DeadLine=(Get-Date ((Get-Date).AddDays(+1)) -hour 06 -minute 15 -second 0), #Set a default deadline, tomorrow at 615

# Loop through the list of groups matching $Pattern and take action on them
ForEach ( $Group in (Get-PoshWSUSGroup | where {$_.Name -Like "*$Pattern*" }) )
        # Set variables for each group, such as Group Deadline and a variable containing all updates retrieved from the SourceGroupName
        $Deadline = (Get-Date ((Get-Date).AddDays(+1)) -hour ($Group.Name.Split("{_}")[-1].Substring(0,2)) -minute 15 -second 0) #Hour for the Deadline will be set to the first two letters of the last part of the WSUS-Group name and use as deadline (WSUS Group name like: Tuesday_0300)
        $Updates = (Get-PoshWSUSUpdateApproval -UpdateScope (New-PoshWSUSUpdateScope -FromCreationDate $CreationDate -IncludedInstallationStates "Installed") | where { $_.TargetGroup -eq $SourceGroupName }).GetUpdate() 
        # Approve the list of Updates from the WSUS group specified in $SourceGroupName on the WSUS target Groups specified in $WSUSGroups
        $Updates | Approve-PoshWSUSUpdate -Action Install -Group $Group.Name -Deadline $Deadline
Mar 31, 2015 at 10:46 PM
Hi Larksyrm

Thanks for the suggestion. Finally getting time to look at this again and looking forward to trying it out.

Peace, love and MACHINE empathy