技术控

    今日:122| 主题:49179
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Saying Farewell to Snapins!

[复制链接]
与阿妹共舞 发表于 3 天前
78 6

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
One of the key improvements to the VMware PowerCLI 6.5 R1 release is the absence of PowerShell snapins. All of the remaining snapins have been converted to modules!
  Snapin History

  If you don’t know why this is such a big deal, let me take a second to cover some history on snapins. Going back to the days of PowerShell version 1, snapins were the only way to extend the shell, or add additional features and functionalities. The issue with snapins begin due to how they can only be written in a .NET programming language and then have to be assembled before being handed off to the user. Then, once the user has them, the issues continue due to the snapins having to be installed and registered to each individual system a user wishes to use them on. Snapins also lack the ability to explicitly define dependencies, this causes issues for a product like PowerCLI which is comprised of several individual components.
  PowerShell version 2 introduced modules, which resolved a majority of those issues. Modules can still be written in any .NET programming language, or can even be written in PowerShell itself! Modules are mobile and don’t require any registrations. Once the modules are in hand, they can be referenced automatically by placing them in one of the proper folders or by specifying the directory path to where they reside for each system requiring access.
  Finding Snapins

  This change in architecture introduces an issue for already created scripts which are trying to load the old VMware snapins. Instead of performing something that looks like:
  Add-PSSnapin –Name VM*
  We’re recommending a replacement from that command to this command:
  Get-Module –ListAvailable VM* | Import-Module
   We’re not going to leave the rest to you to handle. There’s some functions which have been added to the PowerCLI Community Repository which will point out which scripts contain that line. There’s also a function which can comment out that line and add the new recommended command. These functions are available within the Update_PowerCLI_Scripts.ps1 script .
  The first function is “Get-PowerCLISnapinUse” and will show what scripts (.ps1 extensioned) include the string “Add-PSSnapin*VM*” and will display the file name, line where the string resides, path to the directory, and the full path of the file.
   
Saying Farewell to Snapins!-1 (individual,additional,registered,continue,features)

  The second function is “Update-PowerCLISnapinUse” and is based around adding the new Import-Module command and commenting that string out.

Saying Farewell to Snapins!-2 (individual,additional,registered,continue,features)

  Additionally, if you’ve already updated your version of PowerCLI, you may have noticed the installation directory has changed as well. If you have the “Initialize-PowerCLIEnvironment” script hardcoded into your scripts, there are also some functions to handle that as well. The functions for that are done by way of “Get-PowerCLIInitialization” and “Update-PowerCLIInitialization”. These functions work similarly to the above, however the “Update-PowerCLIInitialization” function just updates the directory path and does not comment anything out.
  Conclusion

  VMware PowerCLI moving over to be completely modules is a huge accomplishment in this newest release. As always, it’s backwards compatible and we recommend upgrading to the latest version.
   You can find the PowerCLI 6.5 Release 1 downloadHERE.
友荐云推荐




上一篇:HDDCryptor: Subtle Updates, Still a Credible Threat
下一篇:Adding a Simple GUI to shell scripts with kdialog
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

楼主不许动,我是来抢沙发的,沙发没有,板凳也行!
回复 支持 反对

使用道具 举报

看咱Q915409190 发表于 3 天前
画面太美我不敢看
回复 支持 反对

使用道具 举报

putihan 发表于 3 天前
在职场中就应该像柯南那样,有一种我走到哪就让别人死到哪的霸气。
回复 支持 反对

使用道具 举报

Fran丶 发表于 前天 03:27
失去某人,最糟糕的莫过于,他近在身旁,却犹如远在天边.
回复 支持 反对

使用道具 举报

new5201314 发表于 前天 05:33
心里只有你一个频道,最可恨的是还没有广告。
回复 支持 反对

使用道具 举报

萘小萘 发表于 前天 14:10
垃圾内容,路过为证。
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表