Giter Site home page Giter Site logo

updates-automation's People

Contributors

charlesnru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

updates-automation's Issues

Computer Groups

Hi ,
how can i import only computer groups and not all Approvals xml ?

locale dependent $allComputersGroupName

Hello, please find attached a diff for a very simplicistic implementation of local dependent "All Computers" group name.
My powershell skills are far to waek to implement something more sophisticated, like checking WSUS or current locale.
So it's a simple config extension...
`--- /home/gharry-bsd/Downloads/tmp-share/Invoke-WSUSImportExportManager.ps1 2020-08-31 07:32:59.053029000 +0200
+++ /home/gharry-bsd/Downloads/tmp-share/Invoke-WSUSImportExportManager.new.ps1 2020-08-31 11:11:13.317294651 +0200
@@ -1344,7 +1344,7 @@
[void]$WSUSXMLConfigRoot.AppendChild($WSUSXMLComputerGroups)

  •    $allComputersGroup = $WSUSServer.GetComputerTargetGroups() | Where-Object {$_.name -eq "All Computers"}
    
  •    $allComputersGroup = $WSUSServer.GetComputerTargetGroups() | Where-Object {$_.name -eq $allComputersGroupName}
       $allComputersGroupElement = $WSUSXMLConfig.CreateElement("ComputerGroup")
       $allComputersGroupElement.InnerText = $($allComputersGroup.Name)
    

@@ -1852,15 +1852,15 @@
if($computerGroups){

             [System.Xml.XmlElement]$allComputersGroupElement = $computerGroups.ComputerGroup
  •            $allComputersGroupName = "All Computers"
    
  •            # Defined via config file due to local dependency: $allComputersGroupName = "All Computers"
    
               #Verify that the first computer group is "All Computers"
               if($($allComputersGroupElement.'#text') -eq $allComputersGroupName){
                   $subGroups = $allComputersGroupElement.ComputerGroup
    
  •                $allComputersGroup = $WSUSServer.GetComputerTargetGroups() | Where-Object {$_.Name -eq "All Computers"}
    
  •                $allComputersGroup = $WSUSServer.GetComputerTargetGroups() | Where-Object {$_.Name -eq $allComputersGroupName}
    
  •                #$currentAllComputersSubGroups = $WSUSServer.GetComputerTargetGroups() | Where-Object {($_.Name -ne "All Computers") -and ($_.GetParentTargetGroup() -eq $allComputersGroup)} | Select-Object -ExpandProperty Name
    
  •                #$currentAllComputersSubGroups = $WSUSServer.GetComputerTargetGroups() | Where-Object {($_.Name -ne $allComputersGroupName) -and ($_.GetParentTargetGroup() -eq $allComputersGroup)} | Select-Object -ExpandProperty Name
                   foreach($subGroup in $subGroups){
                       if($subGroup -is [System.Xml.XmlElement]){#Computer group has sub groups
                           New-ComputerGroupFromXML -ParentComputerGroup $allComputersGroup -NewComputerGroupElement $subGroup
    

@@ -3036,6 +3036,21 @@
}

#endregion Parameter validation
+
+
+# Locale dependent "All Computers"
+If($Export -or $Import){
+

  • If($Import){
  •    [string]$allComputersGroupName = $ImportOptions | Where-Object {$_.Name -eq "XMLConfiguration"} | Select-Object -ExpandProperty AllComputersGroupName -ErrorAction:Ignore
    
  •    catch{ $allComputersGroupName = "All Computers" }
    
  • }elseif($Export){
  •    [string]$allComputersGroupName = $ExportOptions | Where-Object {$_.Name -eq "XMLConfiguration"} | Select-Object -ExpandProperty AllComputersGroupName -ErrorAction:Ignore
    
  • }
  • IF([string]::IsNullOrEmpty($allComputersGroupName)) { $allComputersGroupName = "All Computers" }

+}

#Try to load the UpdateServices module.
Try {`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.