export_and_import_install_roles_and_features_on_a_server_2012r2_2016_via_powershell

Exportieren der Einstellungen in eine CSV vom Quellserver und Installieren auf einem anderen Zielserver

copyrolesandfeatures_remote.ps1
<
Write-Host 
Write-Host "Copy Roles and Features from one Server to another" -foreground "yellow"
Write-Host 
 
$ServerNameSource = Read-Host "ServerName of Source Server"
$ServerNameDest = Read-Host "ServerName of Destination Server"
 
function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$ScriptPath = Get-ScriptDirectory
 
Get-WindowsFeature -ComputerName $ServerNameSource | where{$_.Installed -eq $True} | select name | Export-Csv $ScriptPath\Roles_$ServerNameSource.csv -NoTypeInformation -Verbose
 
Start-Sleep -s 30
 
Import-Csv $ScriptPath\Roles_$ServerNameSource.csv | foreach{Add-WindowsFeature $_.name -computerName $ServerNameDest}
export_and_import_install_roles_and_features_on_a_server_2012r2_2016_via_powershell.txt · Last modified: 2019/02/14 08:26 by 192.168.1.1