使用
this TechNet page上的信息,我已经成功建立了一个远程PowerShell会话,其中包含在Hyper-V VM中运行的2016 Preview 2 Nano Server.
我现在想要添加SMTP服务器角色.我期待这是一个微不足道的事情,因为我们了解Nano Server是Windows Server的未来,并将完成我们从Windows Server习惯的一切,除了它是“无头”,即只能管理远程,通过WMI和PowerShell完成.
但是,似乎没有使用PowerShell cmdlet(如Add-WindowsFeature)以传统方式添加角色和功能,而是使用dism将包添加到VHD映像.好的,但只有大约五个包,不包括SMTP服务器.仅与Hyper-V,故障转移群集,网络和文件服务器角色有关.
我在远程PowerShell会话中尝试了Add-WindowsFeature等,但它无法识别任何常见的cmdlet名称.我怀疑这不仅仅是不存在的cmdlet.
也许这只是预发布Nano Server的限制?但我找不到任何相关的声明.
是否可以在Nano Server中添加SMTP服务器角色?
编辑:这是Get-WindowsFeature的输出:
PS C:\Users\Administrator\Documents> Get-WindowsFeature Command 'Get-WindowsFeature' cannot be found.
……以及Get-Module:
PS C:\Users\Administrator\Documents> get-module -listavailable Directory: C:\windows\system32\windowspowershell\v1.0\Modules ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Manifest 1.0.0.0 CimCmdlets {Get-CimAssociatedInstance,Get-CimClass,Get-CimInstance,... Manifest 1.0 Defender {Get-MpPreference,Set-MpPreference,Add-MpPreference,Remo... Script 3.0 Dism {Add-AppxProvisionedPackage,Add-WindowsDriver,Add-Windows... Manifest 0.0 DnsClient Manifest 1.0.0.0 EventTracingManagement {New-EtwTraceSession,Get-EtwTraceSession,Set-EtwTraceSess... Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Content,Clear-Content,Clear-ItemProperty,Join-Path...} Manifest 3.0.0.0 Microsoft.PowerShell.Security {Get-Acl,Set-Acl,Get-PfxCertificate,Get-Credential...} Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Format-List,Format-Custom,Format-Table,Format-Wide...} Manifest 3.0.0.0 Microsoft.WSMan.Management {Disable-WSManCredSSP,Enable-WSManCredSSP,Get-WSManCredSS... Manifest 2.0.0.0 NetAdapter {Disable-NetAdapter,Disable-NetAdapterBinding,Disable-Net... Manifest 1.0.0.0 NetEventPacketCapture {New-NetEventSession,Remove-NetEventSession,Get-NetEventS... Manifest 1.0.0.0 NetTCPIP {Get-NetIPAddress,Get-NetIPInterface,Get-NetIPv4Protocol,... Manifest 1.0.0.0 PcsvDevice {Get-PcsvDevice,Start-PcsvDevice,Stop-PcsvDevice,Restart... Manifest 1.0.0.0 PnpDevice {Get-PnpDevice,Get-PnpDeviceProperty,Enable-PnpDevice,Di... Manifest 2.0.0.0 SmbShare {Get-SmbShare,Remove-SmbShare,Set-SmbShare,Block-SmbShar... Manifest 2.0.0.0 SmbWitness {Get-SmbWitnessClient,Move-SmbWitnessClient,gsmbw,msmbw...} Manifest 2.0.0.0 Storage {Add-InitiatorIdToMaskingSet,Add-PartitionAccessPath,Add-... (end)
现在是Nano Servers的早期阶段.我们现在所拥有的是早期预览,仅支持非常有限的功能. IIS和SMTP不在其中.
Get-WindowsFeature来自服务器管理器模块,该模块未在Nano上启用
dism.exe -online -get-features -format:table
你会得到类似的东西:
------------------------------------- | -------- Feature Name | State ------------------------------------- | -------- ServerManager-Core-RSAT | Disabled ServerManager-Core-RSAT-Role-Tools | Disabled ServerManager-Core-RSAT-Feature-Tools | Disabled FileAndStorage-Services | Enabled Storage-Services | Enabled File-Services | Enabled CoreFileServer | Enabled File-Services-Search-Service | Disabled Dedup-Core | Disabled SmbDirect | Enabled Microsoft-Hyper-V | Enabled FailoverCluster-NanoServer | Enabled SmbWitness | Disabled Storage-Replica | Disabled
您可以使用Enable-WindowsOptionalFeature来启用某些功能,但这并没有多大帮助.