Hi @Michał Pachnik ,
You can install the .NET Desktop Runtime on all computers in a domain at once using PowerShell.
Ensure you have domain admin privileges and Windows Firewall allows PowerShell Remoting and file sharing is enabled.
Download the offline installer for .NET Desktop Runtime (EXE or MSI) and place it in a shared folder accessible by all domain computers (e.g., \\ServerName\SharedFolder\dotnet-runtime-x64.exe
).
Uses Invoke-Command
to remotely execute the installer on each domain computer:
# Define the shared location of the installer
$installerPath = "\\ServerName\SharedFolder\dotnet-runtime-x64.exe"
$arguments = "/quiet /norestart"
# Get a list of all computers in the domain
$computers = Get-ADComputer -Filter * | Select-Object -ExpandProperty Name
# Install on each computer
foreach ($computer in $computers) {
Write-Host "Installing .NET Runtime on $computer..."
# Check if the computer is online
if (Test-Connection -ComputerName $computer -Count 1 -Quiet) {
try {
Invoke-Command -ComputerName $computer -ScriptBlock {
param ($installerPath, $arguments)
Start-Process -FilePath $installerPath -ArgumentList $arguments -Wait
} -ArgumentList $installerPath, $arguments -ErrorAction Stop
Write-Host "Installation completed on $computer."
} catch {
Write-Host "Failed to install on $computer: $_"
}
} else {
Write-Host "$computer is offline. Skipping."
}
}
Best Regards.
Jiachen Li
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.