- 1 year ago
Install RSAT using powershell script to windows 10 with elevated privileges
To install Remote Server Administration Tools (RSAT) on Windows 10 using a PowerShell script with elevated privileges, you can follow these steps:
Open Notepad or any text editor.
Copy and paste the following code into the text editor:
powershell$ErrorActionPreference = "Stop"
# Define the RSAT feature names to be installed
$RSATFeatures = @(
"RSAT-ADDS",
"RSAT-AD-Tools",
"RSAT-DHCP",
"RSAT-DNS-Server",
"RSAT-File-Services",
"RSAT-Group-Policy",
"RSAT-Licensing-Tools",
"RSAT-Network-Controller",
"RSAT-RemoteAccess",
"RSAT-RemoteDesktop-Services",
"RSAT-ServerManager",
"RSAT-Storage-Migration-Service",
"RSAT-Volume-Activation-Tools"
)
# Install the RSAT features
foreach ($feature in $RSATFeatures) {
$featureStatus = Get-WindowsCapability -Online | Where-Object { $_.Name -like "Rsat.*.$feature" }
if ($featureStatus -eq $null) {
Write-Host "Installing $feature..."
Add-WindowsCapability -Online -Name "Rsat.*.$feature*" -ErrorAction SilentlyContinue
} else {
Write-Host "$feature is already installed."
}
}
Write-Host "RSAT installation completed."
Save the file with a
.ps1
extension, such asinstall_rsat.ps1
.Press Win + X and select "Windows PowerShell (Admin)" to open an elevated PowerShell session.
Navigate to the directory where you saved the
install_rsat.ps1
script using thecd
command. For example, if you saved the script on your desktop, you can use the following command:
powershellcd C:\Users\YourUsername\Desktop
Replace YourUsername
with your actual Windows username.
- Execute the PowerShell script by running the following command:
powershellSet-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
.\install_rsat.ps1
The script will start installing the RSAT features one by one. It will skip any features that are already installed.
Once the installation is completed, you will see the "RSAT installation completed" message.
Please note that running PowerShell scripts with elevated privileges can have security implications. Make sure to review the script's content and only run scripts from trusted sources.