Windows Management Framework V5 Preview

标题:Windows Management Framework 5.0 Preview

该管理功能的一个目标就是简化计算环境的创建和操作。 在 Windows Server 2012 R2 中,我们引入了两项基于标准的技术来实现这一目标:Windows PowerShell Desired State Configuration 和 Certified for Windows Network Switches。 我们的客户和合作伙伴对这两项新技术的引入感到无比的兴奋和期待。今天,我们宣布推出 Preview of Windows Management Framework V5,该产品为上述技术领域带来新的突破,同时引入的 Windows PowerShell OneGet,将使您在计算机上查找和安装软件将变得极为简单。 OneGet 可以与名为 Chocolatey 的基于社区的软件存储库协作,该软件库具有超过 1,700 个软件包。 我们还会逐步提供新的技术,来简化计算环境的创建和操作。

此致! Jeffrey

在本版本中,通过解决缺陷修复、性能改进和一般优化,我们令 Windows PowerShell Desired State Configuration (DSC) 更为稳定和可靠。这些改进功能与我们最近发布的第 3 轮 DSC 资源包的一起,为您提供在所有 Windows 环境中有效部署和管理您的功能、应用程序和服务所需的一切。 作为开发人员,您应为您的资源编写 DSC 提供程序,以便客户可以使用 DSC 或选择任何支持 DSC 平台的配置管理工具。 如果您正考虑购买配置管理工具,则一定要确保该工具支持 DSC,否则您将与 Windows Server 的策略不一致。

除了新增 DSC,WMF 5.0 Preview 还包括 2 个新功能 OneGet 和 NetworkSwitch cmdlet。 您可以在此下载 WMF 5.0 Preview。

Windows PowerShell OneGet

OneGet 是一种从 web 中发现和安装软件包的新方式。有了 OneGet,您可以:

· 管理软件存储库的列表,可以在该存储库中搜索、购买和安装软件包

· 搜索和筛选您的存储库,以便查找所需的软件包

· 利用一个 PowerShell 命令,便可从一个或多个存储库中无缝安装和卸载软件包

 

OneGet 的第一个版本从 Chocolatey 存储库安装和搜索软件。 后续版本将开始增加对其他存储库的支持。 以下是帮助您着手使用的一些示例命令:

导入模块:

PS> Import-Module -Name OneGet

列举可用 OneGet 命令的列表:

PS> Get-Command -Module OneGet

 

CommandType Name ModuleName

----------- ---- ----------

Cmdlet Add-PackageSource OneGet   

Cmdlet Find-Package OneGet   

Cmdlet Get-Package OneGet   

Cmdlet Get-PackageSource OneGet   

Cmdlet Install-Package OneGet   

Cmdlet Remove-PackageSource OneGet   

Cmdlet Uninstall-Package OneGet   

Network Switches

在 Windows Server 2012 R2 中,Microsoft 与业内人士以及 DMTF(分布式管理任务组)合作,对管理网络交换机的架构和协议进行标准化。我们发布了 Windows Server 徽标认证计划以便确保互操作性。这项工作是数据中心抽象 (DAL) 愿景的一部分,该愿景由 Microsoft 与以下行业领先公司共同主导:Arista、Cisco 和华为。现在利用 Windows Server 2012 R2,可以由 System Center Virtual Machine Manager 2012 R2 (SCVMM) 对通过 Windows 计划认证的网络交换机进行本机管理,而无需编写自定义插件。您可以在此了解更多详细信息

2013 年 7 月,我们发布了博客动态 DAL:利用 PowerShell 和 CIM 管理网络交换机,该博客描述了如何利用 CIM cmdlet 通过 PowerShell 管理网络交换机。

在本版本中,我们增加了一组可对L2 层 NetworkSwitch 进行管理的 PowerShell cmdlet,以此管理通过 Windows 认证的网络交换机。

以下是您可以如何使用 NetworkSwitch cmdlet 的一些示例:

导入模块:

PS>import-module .\NetworkSwitch.psd1

 

列举网络交换机 Cmdlet 的列表

PS> Get-Command *-NetworkSwitch*

CommandType Name ModuleName                                                                 

----------- ---- ----------                                                                 

Function Disable-NetworkSwitchEthernetPort NetworkSwitch                                                              

Function Disable-NetworkSwitchFeature NetworkSwitch                                                              

Function Disable-NetworkSwitchVlan NetworkSwitch                                                              

Function Enable-NetworkSwitchEthernetPort NetworkSwitch                                                              

Function Enable-NetworkSwitchFeature NetworkSwitch                                                              

Function Enable-NetworkSwitchVlan NetworkSwitch                                                              

Function Get-NetworkSwitchEthernetPort NetworkSwitch                                                              

Function Get-NetworkSwitchFeature NetworkSwitch                                                              

Function Get-NetworkSwitchGlobalData NetworkSwitch                                                               

Function Get-NetworkSwitchVlan NetworkSwitch                                                              

Function New-NetworkSwitchVlan NetworkSwitch                                                              

Function Remove-NetworkSwitchEthernetPortIPAdd.. NetworkSwitch                                                              

Function Remove-NetworkSwitchVlan NetworkSwitch                                                              

Function Restore-NetworkSwitchConfiguration NetworkSwitch                                                              

Function Save-NetworkSwitchConfiguration NetworkSwitch                                                              

Function Set-NetworkSwitchEthernetPortIPAddress NetworkSwitch                                                              

Function Set-NetworkSwitchPortMode NetworkSwitch                                                              

Function Set-NetworkSwitchPortProperty NetworkSwitch                                                              

Function Set-NetworkSwitchVlanProperty NetworkSwitch  

 

要管理交换机,您需要创建 CIM 会话连接。您可以按照以下示例中所示操作,并且在 $s 变量中存储会话上下文:

PS> $ip = "10.0.0.2"

PS> $sessionOption = New-CimSessionOption -UseSsl -SkipCACheck -SkipCNCheck -SkipRevocationCheck

PS> $s = New-CimSession -CN $ip -port 5986 -Auth Basic -Credential admin -SessionOption $sessionOption

 

列举 NetworkSwitch 功能:

PS> Get-NetworkSwitchFeature -CimSession $s

ElementName InstanceID FeatureName IsEnabled PSComputerName

----------- ---------- ----------- --------- --------------

SSH Arista:Feature:2 2 True 10.0.0.2       

Tacacs Arista:Feature:3 3 True 10.0.0.2      

BGP Arista:Feature:4 4 False 10.0.0.2      

VLAN Arista:Feature:5 5 True 10.0.0.2      

LACP Arista:Feature:6 6 True 10.0.0.2      

DHCP Arista:Feature:7 7 False 10.0.0.2      

LLDP Arista:Feature:8 8 True 10.0.0.2       

 

列举所有端口:

PS> Get-NetworkSwitchEthernetPort -CimSession $s | Format-Table InstanceID, ElementName, MaxSpeed, PortNumber, EnabledState

 

InstanceID ElementName MaxSpeed PortNumber EnabledState

---------- ----------- -------- ---------- ------------

Arista:Ether... Ethernet1 1410065408 1 2

Arista:Ether... Ethernet2 1410065408 2 2

Arista:Ether... Ethernet3 1410065408 3 2

Arista:Ether... Management1 1410065408 97 2

 

禁用端口号 3:

PS>  Disable-NetworkSwitchEthernetPort -PortNumber 3 -CimSession $s

 

                ReturnValue Job PSComputerName          

               ----------- --- --------------          

                         0 10.0.0.2     

 

获取端口号 3 的状态:

PS>get-NetworkSwitchEthernetPort -PortNumber 3 -CimSession $s | FT InstanceID, ElementName, MaxSpeed, PortNumber, EnabledState

 

 

InstanceID ElementName MaxSpeed PortNumber EnabledState

---------- ----------- -------- ---------- ------------

Arista:Ether... Ethernet3 1410065408 3 3

 

云操作系统基础结构团队