ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Install Chocolatey Remotely on Domain Computers

    IT Discussion
    chocolatey windows domain remote powershell remote management install installation install guide psremoting
    3
    3
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dbeatoD
      dbeato
      last edited by

      Enable PS Remoting in your Domain by following the Guide here

      https://devblogs.microsoft.com/scripting/enable-powershell-remoting-to-enable-running-command

      Then run this Powershell Script from a System with the Active Directory Powershell Modules installed: (Example below only installs it on the computers that are less or equal than 2 months old)

      Import-Module ActiveDirectory
      
      # get today's date
      $today = Get-Date
      
      #Get today - 60 days (2 month old)
      $cutoffdate = $today.AddDays(-60)
      
      $computers= Get-ADComputer -Properties * -Filter {LastLogonDate -gt $cutoffdate} | Select-Object -ExpandProperty Name
      
      
      foreach ($comp in $computers)
      {
         Invoke-Command -computername $comp {Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))}
      }
      

      Script is below
      https://github.com/dbeato/scripts/blob/master/Chocolatey/Install-Chocolatey-AD.ps1

      This can be automated and changed as well to fit your needs.

      1 Reply Last reply Reply Quote 7
      • scottalanmillerS
        scottalanmiller
        last edited by

        This is some awesome stuff.

        1 Reply Last reply Reply Quote 0
        • wrx7mW
          wrx7m
          last edited by

          Nice! I was thinking about doing this soon.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post