I'm trying to create a VM and install Web-Server role using powershell with this command
"Install Web Server" Invoke-Command -ComputerName $vmInfo.vip -Port $vmInfo.port -Credential $localCredential -UseSSL -SessionOption $psSessionOptions -ScriptBlock { Import-Module ServerManager $info = Get-WindowsFeature | Where-Object {$_.Name -match “Web-Server”} | Select-Object -Property Installed if ($info.Installed -eq $false) { Install-WindowsFeature -name Web-Server -IncludeAllSubFeature -IncludeManagementTools } }
I always get the following error.
The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be downloaded.
Use the "source" option to specify the location of the files that are required to restore the feature. For more
information on specifying a source location, see
http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f0906
+ CategoryInfo : InvalidOperation: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature],
Exception
+ FullyQualifiedErrorId : DISMAPI_Error__Cbs_Download_Failure,Microsoft.Windows.ServerManager.Commands.AddWindowsF
eatureCommand
+ PSComputerName : 138.91.75.143
But if I connect to the machine and manually install the Web-Server it has no problems. What am I missing?