Hey all,Â
Brand new to the Automox Community here, really loving the software so far. However, I’m running into a weird issue. So, we’ve gotta update cURL, and I’m running into a pair of issues.
To start, within Automox, I cannot see it as a listed package. I know it’s installed, and can see it in my Tenable dashboard. This leaves the bulk actions/software patching option out.Â
So, in lieu of this, I’ve tried to make a worklet to meet the requirements. I’ve found some powershell online that seems to fit what I’d need it to do, but when I run it on my test machine, I get the attached logs, and the issue persists. Could anyone offer some advice?Â
param (Â
  astring]$SearchBase,
  estring]$updatedCurlPath = 'C:\temp\CurlUpdate\curl.exe',
  estring]$sourcePath = 'c$\Windows\System32\curl.exe'
  )
$computers = Get-AdComputer -filter * -SearchBase $SearchBase
# $computers = @()
# $AdGroup = Get-ADGroupMember -Identity "Group Name"
# Foreach ($one in $AdGroup) {
# Â Â $computers += Get-AdComputer -Identity $one.name
# }
$rights = 'FullControl'
$type = 'Allow'
$adminGroup = 'BUILTIN\Administrators'
$adminAccount = aSystem.Security.Principal.NTAccount]::new($adminGroup)
$adminFullAccessRule = bSystem.Security.AccessControl.FileSystemAccessRule]::new($adminGroup, $rights, $type)
$success = @()
$failed = @()
$offline = @()Foreach ($computer in $computers) {
  if (Test-connection -computername $computer.DNSHostName -count 1 -quiet){
    write-host "$($computer.name) is online!" -ForegroundColor Green
    $hostname = $computer.DNSHostName
    $curlPath = "\\$hostname\$sourcePath"
    Try {
      Write-Host "Checking ACL for $($computer.name)"
      $originalAcl = Get-Acl -Path "$curlPath" -ErrorAction stop
      $adminAcl = Get-Acl -Path "$curlPath" -ErrorAction stop
      $adminAcl.SetOwner($adminAccount)
      $adminAcl.AddAccessRule($adminFullAccessRule)
      Invoke-Command -ComputerName $hostname -ScriptBlock {takeown /f "c:\windows\system32\curl.exe"}
      (get-item $curlPath).SetAccessControl($adminAcl)
      $nextstep = $true
    }
    Catch {
      $failed += Âpscustomobject]@{
        name = $computer.name
        message = $_
      }      Â
    }
    if ($nextstep){
      try {
        write-host "Copying $updatedCurlPath to $curlPath"
        Copy-Item -Path $updatedCurlPath -Destination $curlPath -Force
        (get-item $updatedCurlPath).SetAccessControl($originalAcl)
        $success += $computer
      }
      Catch {
        $failed += -pscustomobject]@{
          name = $computer.name
          message = $_
        }
      }
    }
  }
  Else {
    $offline += $computer
  }
}Write-host "`nSuccessful:" -ForegroundColor Green
$success | ForEach-Object {Write-host "$($_.name)."}
write-host "`nFailed:" -ForegroundColor Yellow
$failed | ForEach-Object {Write-host "$($_.name) because: $($_.message)"}
write-host "`nOffline:" -ForegroundColor Red
$offline | ForEach-Object{Write-Host "$($_.name) is offline"}
Â
Then Logs
Successful:
Failed:
Offline:
Â